diff --git a/Dockerfile.client b/Dockerfile.client new file mode 100644 index 0000000..635f794 --- /dev/null +++ b/Dockerfile.client @@ -0,0 +1,4 @@ +FROM nginx:1.27-alpine + +COPY docker/nginx.conf /etc/nginx/conf.d/default.conf +COPY public /usr/share/nginx/html diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..143b2bd --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,19 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location /api/ { + proxy_pass http://server:3000; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location / { + try_files $uri $uri/ /index.html; + } +} diff --git a/server/server.js b/server/server.js index a429520..bdf7ee8 100644 --- a/server/server.js +++ b/server/server.js @@ -4,8 +4,9 @@ import { randomUUID } from "crypto"; import DBAdapter, { getCurrentDate, setCurrentDate } from "./db/database.js"; import { DB_INTERNAL_ERROR, DB_USER_ERROR } from "./db/database.js"; +// Switch to .env for test in local machine dotenv.config({ - path: './server/.env' + path: './server/docker.env' }); const {