diff --git a/frontend_admin/Dockerfile b/frontend_admin/Dockerfile index f82bdae..4aec001 100644 --- a/frontend_admin/Dockerfile +++ b/frontend_admin/Dockerfile @@ -1,12 +1,13 @@ -FROM node:20-alpine - +# Build Stage +FROM node:20-alpine AS build WORKDIR /app - COPY package*.json ./ RUN npm install - COPY . . - +RUN npm run build + +# Production Stage +FROM nginx:stable-alpine AS production +COPY --from=build /app/build /usr/share/nginx/html EXPOSE 5001 - -CMD ["npm", "start"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/frontend_user/Dockerfile b/frontend_user/Dockerfile index 0ed3814..f29ba80 100644 --- a/frontend_user/Dockerfile +++ b/frontend_user/Dockerfile @@ -1,12 +1,13 @@ -FROM node:20-alpine - +# Build Stage +FROM node:20-alpine AS build WORKDIR /app - COPY package*.json ./ RUN npm install - COPY . . - +RUN npm run build + +# Production Stage +FROM nginx:stable-alpine AS production +COPY --from=build /app/build /usr/share/nginx/html EXPOSE 5003 - -CMD ["npm", "start"] +CMD ["nginx", "-g", "daemon off;"]