test(docker): align build-contract test with pnpm fetch caching
This commit is contained in:
1 parent
539e6d3fad
commit
c5284e0b79
1 file changed
+9
-6
@@ -6,18 +6,21 @@ const dockerfile = readFileSync("Dockerfile", "utf8");
|
|||||||
describe("Docker build cache", () => {
|
describe("Docker build cache", () => {
|
||||||
it("installs frozen dependencies before copying application source", () => {
|
it("installs frozen dependencies before copying application source", () => {
|
||||||
const manifests = dockerfile.indexOf(
|
const manifests = dockerfile.indexOf(
|
||||||
"COPY package.json *lock* pnpm-workspace.yaml .npmrc ./",
|
"COPY package.json pnpm-lock.yaml* ./",
|
||||||
);
|
);
|
||||||
|
const fetch = dockerfile.indexOf("pnpm fetch --ignore-scripts");
|
||||||
const install = dockerfile.indexOf("pnpm install --frozen-lockfile");
|
const install = dockerfile.indexOf("pnpm install --frozen-lockfile");
|
||||||
const source = dockerfile.indexOf("COPY . .");
|
const source = dockerfile.indexOf("COPY . .");
|
||||||
expect(manifests).toBeGreaterThan(-1);
|
expect(manifests).toBeGreaterThan(-1);
|
||||||
expect(install).toBeGreaterThan(manifests);
|
expect(fetch).toBeGreaterThan(manifests);
|
||||||
|
expect(install).toBeGreaterThan(fetch);
|
||||||
expect(source).toBeGreaterThan(install);
|
expect(source).toBeGreaterThan(install);
|
||||||
});
|
});
|
||||||
it("retains the package store and Next compiler cache across source changes", () => {
|
it("keeps dependency downloads in a lockfile-only cached layer", () => {
|
||||||
expect(dockerfile).toContain("id=epicnext-pnpm,target=/pnpm/store");
|
expect(dockerfile).toContain("pnpm fetch --ignore-scripts");
|
||||||
expect(dockerfile).toContain("--store-dir=/pnpm/store");
|
expect(dockerfile).toContain(
|
||||||
expect(dockerfile).toContain("id=epicnext-next,target=/app/.next/cache");
|
"pnpm install --frozen-lockfile --ignore-scripts --offline",
|
||||||
|
);
|
||||||
});
|
});
|
||||||
it("ships standalone output without a redundant dependency pruning step", () => {
|
it("ships standalone output without a redundant dependency pruning step", () => {
|
||||||
expect(dockerfile).toContain("/app/.next/standalone ./");
|
expect(dockerfile).toContain("/app/.next/standalone ./");
|
||||||
|
|||||||
Reference in new issue
Block a user