working dockerized environment

This commit is contained in:
Ammar Qaffaf
2024-02-22 01:36:33 +03:00
parent ff1bb4cc41
commit cfb293843e
3 changed files with 34 additions and 21 deletions

View File

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