From ececba95220568c7eaab01225865e167cb14058b Mon Sep 17 00:00:00 2001 From: t-ho Date: Fri, 11 Jul 2025 23:47:33 -0700 Subject: [PATCH] fix: update production Dockerfiles to use yarn instead of npm - Update client/Dockerfile.prod to use yarn install and yarn build - Update server/Dockerfile.prod to use yarn install and yarn prod - Fix Docker build failures in CI/CD pipeline - Ensure consistency with development Dockerfiles that already use yarn --- client/Dockerfile.prod | 8 ++++---- server/Dockerfile.prod | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/Dockerfile.prod b/client/Dockerfile.prod index 81c62af..aea0c5b 100644 --- a/client/Dockerfile.prod +++ b/client/Dockerfile.prod @@ -1,17 +1,17 @@ -FROM node:lts-buster as builder +FROM node:lts-buster AS builder WORKDIR /mern-stack/client COPY ./client ./ -RUN npm ci +RUN yarn install --frozen-lockfile ARG facebook_app_id ENV REACT_APP_FACEBOOK_APP_ID=${facebook_app_id} ARG google_client_id ENV REACT_APP_GOOGLE_CLIENT_ID=${google_client_id} ARG version ENV REACT_APP_VERSION=${version} -RUN npm run build +RUN yarn build FROM nginx:stable-alpine COPY --from=builder /mern-stack/client/build /usr/share/nginx/html COPY ./client/nginx.service.conf.prod /etc/nginx/conf.d/default.conf EXPOSE 3000 -CMD ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && nginx -g "daemon off;" +CMD ["sh", "-c", "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && nginx -g 'daemon off;'"] diff --git a/server/Dockerfile.prod b/server/Dockerfile.prod index c9a435b..5a2e554 100644 --- a/server/Dockerfile.prod +++ b/server/Dockerfile.prod @@ -2,5 +2,5 @@ FROM node:lts-buster WORKDIR /mern-stack/server COPY ./server ./ # NOTE: We don't copy the .env file. Please specify env vars at runtime -RUN npm ci -CMD ["npm", "run", "prod"] +RUN yarn install --frozen-lockfile +CMD ["yarn", "prod"]