diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6f692d5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.env.example +.idea +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cf56234 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +# Create a production build of the app +FROM node:16.9.1 as build +WORKDIR /app +ENV PATH /app/node_modules/.bin:$PATH +COPY package.json ./ +RUN npm install +COPY . . +RUN npm run build + +FROM nginx:stable +COPY --from=build /app/build /usr/share/nginx/html +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx/nginx.conf /etc/nginx/conf.d +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ee90c9d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3.9' +services: + server: + build: + context: . + dockerfile: Dockerfile + #target: final + container_name: 'MauMau-Client' + restart: always + networks: + - MauMau +networks: + MauMau: + # hier later extern naar client + driver: bridge \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..60ee47c --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,21 @@ +server { + + listen 80; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + + # to redirect all the requests to index.html, + # useful when you are using react-router + + try_files $uri /index.html; + } + + error_page 500 502 503 504 /50x.html; + + location = /50x.html { + root /usr/share/nginx/html; + } + +} \ No newline at end of file