From 86e36c9c60f5e827f0cfaf605da99506f168cc3e Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Tue, 29 Oct 2024 14:40:30 +0100 Subject: [PATCH] Docker config --- .dockerignore | 4 ++++ Dockerfile | 22 ++++++++++++++++++++++ nginx.conf | 16 ++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9ccb89d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +# NodeJs +node_modules/ +dist/ +.git/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..de017ba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM node:18-alpine AS build + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install + +COPY . /app + +RUN npm run build + +FROM nginx:18-alpine as prod + +WORKDIR /app + +COPY --from=build /app/dist /usr/share/nginx/html +COPY ./nginx.conf /etc/nginx/nginx.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..469c2b7 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,16 @@ +worker_processes 4; + +events { worker_connections 1024; } + +http { + include mime.types; + + server { + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + } +} \ No newline at end of file -- 2.45.2