diff --git a/.gitignore b/.gitignore index 0f319d1a..8e087851 100644 --- a/.gitignore +++ b/.gitignore @@ -406,3 +406,5 @@ cypress/videos npm-debug.log* yarn-debug.log* yarn-error.log* + +webapp_provider/public diff --git a/webapp_provider/Dockerfile b/webapp_provider/Dockerfile index 667fc261..cadf942b 100644 --- a/webapp_provider/Dockerfile +++ b/webapp_provider/Dockerfile @@ -1,12 +1,8 @@ -FROM node:lts-alpine - -# Create app directory -WORKDIR /usr/src/app - -RUN apk update && apk upgrade - -# Bundle app source -COPY . . - -EXPOSE 5000 -CMD npx serve -s public +# dockerfile +FROM nginx:latest +RUN apt-get update && apt-get upgrade -y +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/nginx.conf +COPY public /var/www/ +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/webapp_provider/nginx.conf b/webapp_provider/nginx.conf new file mode 100644 index 00000000..ae8880c0 --- /dev/null +++ b/webapp_provider/nginx.conf @@ -0,0 +1,46 @@ +worker_processes 1; + +events { worker_connections 1024; } + +http { + + include /etc/nginx/mime.types; + default_type application/octet-stream; + access_log /var/log/nginx/access.log; + sendfile on; + + gzip on; + gzip_comp_level 2; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain application/x-javascript text/xml text/css application/xml; + + server { + listen 80; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + + location /api { + # use dockers dns resolver + # with this nginx can start even when the other containers are not running + resolver 127.0.0.11 valid=30s; + set $upstream_rest FileFighterREST; + proxy_pass http://$upstream_rest:8080/api/; + proxy_redirect off; + } + location /data { + client_max_body_size 30G; + resolver 127.0.0.11 valid=30s; + set $upstream_Filehandler FileFighterFileHandler; + proxy_pass http://$upstream_Filehandler:5000/data; + proxy_redirect off; + } + + location / { + root /var/www; + } + } +}