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", () => {
|
||||
it("installs frozen dependencies before copying application source", () => {
|
||||
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 source = dockerfile.indexOf("COPY . .");
|
||||
expect(manifests).toBeGreaterThan(-1);
|
||||
expect(install).toBeGreaterThan(manifests);
|
||||
expect(fetch).toBeGreaterThan(manifests);
|
||||
expect(install).toBeGreaterThan(fetch);
|
||||
expect(source).toBeGreaterThan(install);
|
||||
});
|
||||
it("retains the package store and Next compiler cache across source changes", () => {
|
||||
expect(dockerfile).toContain("id=epicnext-pnpm,target=/pnpm/store");
|
||||
expect(dockerfile).toContain("--store-dir=/pnpm/store");
|
||||
expect(dockerfile).toContain("id=epicnext-next,target=/app/.next/cache");
|
||||
it("keeps dependency downloads in a lockfile-only cached layer", () => {
|
||||
expect(dockerfile).toContain("pnpm fetch --ignore-scripts");
|
||||
expect(dockerfile).toContain(
|
||||
"pnpm install --frozen-lockfile --ignore-scripts --offline",
|
||||
);
|
||||
});
|
||||
it("ships standalone output without a redundant dependency pruning step", () => {
|
||||
expect(dockerfile).toContain("/app/.next/standalone ./");
|
||||
|
||||
Reference in new issue
Block a user