diff --git a/.env.old b/.env.old new file mode 100644 index 0000000..86c714e --- /dev/null +++ b/.env.old @@ -0,0 +1,2 @@ +REACT_APP_VERSION=$npm_package_version +REACT_APP_NAME=$npm_package_name \ No newline at end of file diff --git a/.env.production b/.env.production index 5e984a9..ff3b30f 100644 --- a/.env.production +++ b/.env.production @@ -1 +1 @@ -REACT_APP_BACKEND = "http://api:3000/api/v0/" \ No newline at end of file +REACT_APP_BACKEND = "http://localhost:3000/api/v0/" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 97fa9b1..e8a13ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,14 @@ -FROM node:18 +FROM node:18 as builder RUN mkdir /frontend-server WORKDIR /frontend-server COPY ./ /frontend-server RUN npm install -RUN npm install -g serve -RUN npm run build --omit=dev \ No newline at end of file +RUN npm run build --omit=dev + + +FROM nginx:latest + +COPY --from=builder /frontend-server/build /usr/share/nginx/html/ +COPY --from=builder /frontend-server/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..71a7726 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,26 @@ +server { + listen 80; + root /usr/share/nginx/html; + + gzip on; + gzip_proxied any; + gzip_types + binary/octet-stream + text/css + text/javascript + text/xml + text/plain + application/javascript + application/x-javascript + application/json; + + location /api/ { + proxy_pass http://api:3000/api/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + client_max_body_size 16400M; + } +}