Skip to content

Commit

Permalink
Have a separate vendor build stage in Dockerfile to enable cache
Browse files Browse the repository at this point in the history
  • Loading branch information
yutotakano committed Dec 2, 2024
1 parent 931a2bf commit 360d379
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit 360d379

Please sign in to comment.