Skip to content

Commit

Permalink
Merge pull request #99 from gipplab/https-in-docker
Browse files Browse the repository at this point in the history
Use nginx in docker again and keys of host system. This way host does…
  • Loading branch information
jpwahle authored Aug 21, 2022
2 parents 75d38be + b021651 commit 7045e3a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
9 changes: 7 additions & 2 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 /cs-insights-frontend
WORKDIR /cs-insights-frontend
COPY ./ /cs-insights-frontend

WORKDIR /cs-insights-frontend
RUN npm install
RUN npm run build --omit=dev
RUN npm run build --omit=dev

FROM nginx:latest

COPY --from=builder /cs-insights-frontend/build /usr/share/nginx/html/
COPY --from=builder /cs-insights-frontend/nginx.conf /etc/nginx/conf.d/default.conf
20 changes: 13 additions & 7 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
server {
listen 80;
listen 443 ssl;
server_name: www.cs-insights.uni-goettingen.de;
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}

server {
listen 443 default ssl;
server_name cs-insights.uni-goettingen.de;
ssl_certificate /etc/letsencrypt/live/cs-insights/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cs-insights/privkey.pem;

error_log /var/log/nginx/debug.log debug;
gzip on;
gzip_proxied any;
gzip_types
Expand All @@ -22,7 +28,7 @@ server {
try_files $uri $uri/ /index.html;
index index.html index.htm;
}

location /api/ {
proxy_pass http://backend:3000/api/;
proxy_http_version 1.1;
Expand All @@ -31,5 +37,5 @@ server {
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
client_max_body_size 16400M;
}
}
}
}

0 comments on commit 7045e3a

Please sign in to comment.