diff --git a/internal/nodejs/__snapshots__/template_test.snap b/internal/nodejs/__snapshots__/template_test.snap index 948829bc..bbb6b623 100755 --- a/internal/nodejs/__snapshots__/template_test.snap +++ b/internal/nodejs/__snapshots__/template_test.snap @@ -6,8 +6,14 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all + +# Install dependencies and create a cache layer. +COPY package.json* package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +RUN yarn install + COPY . . +# Try to install again in case there were something we didn't catch RUN yarn install # Build if we can build it @@ -27,8 +33,14 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all + +# Install dependencies and create a cache layer. +COPY package.json* package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +RUN yarn install + COPY . . +# Try to install again in case there were something we didn't catch RUN yarn install # Build if we can build it @@ -59,8 +71,14 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all + +# Install dependencies and create a cache layer. +COPY package.json* package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +RUN yarn install + COPY . . +# Try to install again in case there were something we didn't catch RUN yarn install # Build if we can build it @@ -91,8 +109,14 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all + +# Install dependencies and create a cache layer. +COPY package.json* package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +RUN yarn install + COPY . . +# Try to install again in case there were something we didn't catch RUN yarn install # Build if we can build it @@ -112,8 +136,14 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all + +# Install dependencies and create a cache layer. +COPY package.json* package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +RUN yarn install + COPY . . +# Try to install again in case there were something we didn't catch RUN yarn install # Build if we can build it diff --git a/internal/nodejs/templates/template.Dockerfile b/internal/nodejs/templates/template.Dockerfile index ffcacce0..c7ccf89c 100644 --- a/internal/nodejs/templates/template.Dockerfile +++ b/internal/nodejs/templates/template.Dockerfile @@ -4,8 +4,14 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all + +# Install dependencies and create a cache layer. +COPY package.json* package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +RUN {{ .InstallCmd }} + COPY . . +# Try to install again in case there were something we didn't catch RUN {{ .InstallCmd }} # Build if we can build it