fix dockerfile

This commit is contained in:
Ammar Qaffaf
2024-02-22 03:02:39 +03:00
parent fee8c94c42
commit 8a5f6597d7

View File

@ -1,6 +1,10 @@
FROM node:20 as builder FROM node:20-alpine
WORKDIR /src/app RUN apk add --no-cache nginx
COPY nginx.conf /etc/nginx/nginx.conf
WORKDIR /app
COPY package*.json ./ COPY package*.json ./
@ -10,20 +14,6 @@ COPY . .
RUN npm run build RUN npm run build
# Runtime stage
FROM node:20-alpine
RUN apk add --no-cache nginx
COPY nginx.conf /etc/nginx/nginx.conf
WORKDIR /app
COPY --from=builder /src/app/dist/apps/auth ./auth
COPY --from=builder /src/app/dist/apps/backend ./backend
COPY package*.json ./
RUN npm install
EXPOSE 80 EXPOSE 80
CMD ["sh", "-c", "nginx -g 'daemon off;' & node auth/main.js & node backend/main.js"] CMD ["sh", "-c", "nginx -g 'daemon off;' & npm run start:all"]