Skip to content

Commit

Permalink
Merge pull request #54 from gipplab/dev
Browse files Browse the repository at this point in the history
feat(Deploy): Make frontend and backend talk with nginx and docker #m…
  • Loading branch information
jpwahle authored Jul 11, 2022
2 parents 0ab6c6e + bb1582e commit 765fedb
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .env.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REACT_APP_VERSION=$npm_package_version
REACT_APP_NAME=$npm_package_name
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_BACKEND = "http://api:3000/api/v0/"
REACT_APP_BACKEND = "http://localhost:3000/api/v0/"
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
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
26 changes: 26 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 765fedb

Please sign in to comment.