diff --git a/docker-compose.yml b/docker-compose.yml index b19108c9a..ed9bcbee0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,35 @@ version: "3.9" -services: +services: + # RUN SCHOLIA ALONE webapp: image: scholia build: . ports: - 8100:8100 - expose: - - 8100 volumes: - - .:/scholia \ No newline at end of file + - .:/scholia + profiles: + - local + + # RUN SCHOLIA WITH NGINX + webapp_proxy: + image: scholia + build: . + profiles: + - proxy + volumes: + - .:/scholia + + nginx: + image: nginx + build: ./nginx/ + ports: + - 80:80 + profiles: + - proxy + depends_on: + - webapp_proxy + + + diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 000000000..c8863e43e --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,12 @@ +# Dockerfile-nginx + +FROM nginx:latest + +# Nginx will listen on this port +EXPOSE 80 + +# Remove the default config file that +# /etc/nginx/nginx.conf includes +RUN rm /etc/nginx/conf.d/default.conf + +COPY nginx.conf /etc/nginx/conf.d diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 000000000..9b78f26c8 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,23 @@ +upstream scholia_server { + server webapp_proxy:8100; +} + +server { + listen 80; + server_name localhost; + + #access_log /home/bcapi/logs/nginx-access.log; + #error_log /home/bcapi/logs/nginx-error.log; + + location / { + 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-Proto $scheme; + add_header Access-Control-Allow-Origin *; + add_header Access-Control-Allow-Credentials "true"; + add_header Access-Control-Allow-Headers "Origin, X-Requested-With,Content-Type,Accept,authorization"; + proxy_pass http://scholia_server/; + } + +} \ No newline at end of file