Dockerize the whole web application

This commit is contained in:
OpenVisor 2024-05-03 21:23:25 +02:00
parent 0640b80958
commit cba3e70511
3 changed files with 46 additions and 0 deletions

13
.dockerignore Normal file
View file

@ -0,0 +1,13 @@
# docker files
Dockerfile
docker-compose.yml
# git files
branches
config
descriptiom
HEAD
hooks
info
objects
refs

18
Dockerfile Normal file
View file

@ -0,0 +1,18 @@
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
# use custom error code websites instead
RUN rm -f /usr/share/nginx/html/50x.html
# update default.conf nginx file with necessary try_files statement
RUN rm -f /etc/nginx/conf.d/default.conf
COPY ./default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

15
docker-compose.yml Normal file
View file

@ -0,0 +1,15 @@
networks:
openvisorwebsite-network:
name: openvisorwebsite-network
driver: bridge
external: false
attachable: false
services:
openvisorwebsite-app:
container_name: openvisorwebsite-app
build: .
ports:
- 1443:80
networks:
- openvisorwebsite-network