From 360d379ff74daccbf1ae4652163ecf8d08b4c0bc Mon Sep 17 00:00:00 2001 From: Yuto Takano Date: Mon, 2 Dec 2024 16:34:32 +0100 Subject: [PATCH] Have a separate vendor build stage in Dockerfile to enable cache --- Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a5d226e..10e50c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,15 +13,22 @@ COPY ./tsconfig.json /app/tsconfig.json COPY ./postcss.config.mjs /app/postcss.config.mjs RUN yarn build -FROM node:23-slim AS production +FROM node:23-slim AS vendor WORKDIR /app ENV NODE_ENV=production -COPY --from=build /app/build /app/build COPY --from=build /app/package.json /app/package.json COPY --from=build /app/yarn.lock /app/yarn.lock RUN yarn install --production +FROM node:23-slim AS production +WORKDIR /app + +ENV NODE_ENV=production + +COPY --from=build /app/build /app/build +COPY --from=vendor /app/node_modules /app/node_modules + CMD ["yarn", "remix-serve", "build/server/index.js"]