added prod docker files

This commit is contained in:
Elmar Kresse
2023-09-20 12:32:10 +02:00
parent e56a78bd75
commit d9a72b5b3e
2 changed files with 41 additions and 0 deletions

27
docker-compose.prod.yml Normal file
View File

@ -0,0 +1,27 @@
version: "3.9"
services:
htwkalender-backend:
build:
dockerfile: Dockerfile
context: ./backend
# open port 8090
ports:
- "8090:8090"
command: "/htwkalender serve --http=0.0.0.0:8090 --dir=/pb_data"
volumes:
- ./backend/pb_data:/pb_data
htwkalender-frontend:
build:
context: ./code/
dockerfile: ./frontend/Dockerfile_prod
rproxy:
image: nginx:stable
volumes:
- ./reverseproxy.conf:/etc/nginx/nginx.conf
depends_on:
- htwkalender-backend
- htwkalender-frontend
ports:
- "80:80"

14
frontend/Dockerfile_prod Normal file
View File

@ -0,0 +1,14 @@
# build stage
FROM node:latest as build-stage
WORKDIR /app
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ .
RUN npm run build
# production stage
FROM nginx:stable as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 8000
CMD ["nginx", "-g", "daemon off;"]