diff --git a/dockercompose/docker-compose.yml b/dockercompose/docker-compose.yml index 4fe1fbc..3567ec4 100644 --- a/dockercompose/docker-compose.yml +++ b/dockercompose/docker-compose.yml @@ -1,26 +1,11 @@ services: - nginx: - build: - context: .. - dockerfile: dockerfiles/nginx/Dockerfile - ports: - - "80:80" - depends_on: - - db - - etherpad - - back - - front - networks: - - app-network front: build: context: .. dockerfile: dockerfiles/front/Dockerfile - ports: - - "5000:5000" - - "5080:80" + - "80:80" volumes: - ../doodlestudent/front:/app environment: diff --git a/dockerfiles/front/Dockerfile b/dockerfiles/front/Dockerfile index 6fcaa21..223288c 100644 --- a/dockerfiles/front/Dockerfile +++ b/dockerfiles/front/Dockerfile @@ -13,12 +13,8 @@ RUN npx ng build FROM nginx:alpine COPY --from=build /app/dist/tlcfront /usr/share/nginx/html -COPY nginxFront.conf /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] - - -#docker build -f dockerfiles/front/Dockerfile -t front_image . -#docker run --rm -p8080:80 front_image \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/dockerfiles/nginx/Dockerfile b/dockerfiles/nginx/Dockerfile deleted file mode 100644 index 3ddb6a3..0000000 --- a/dockerfiles/nginx/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM nginx:latest - -COPY nginx.conf /etc/nginx/conf.d/default.conf - -COPY index.html /usr/share/nginx/html/ - -EXPOSE 80 - -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index 6c357dc..8200938 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,6 +1,3 @@ -########################## -## FRONTEND + API -########################## server { listen 80; listen [::]:80; @@ -10,7 +7,7 @@ server { index index.html; ########################## - # Proxy API requests to the back service + # API ########################## location /api/ { proxy_pass http://back:8080; @@ -19,57 +16,23 @@ server { 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; - proxy_set_header Connection ""; } + ########################## - # FrontEnd returns + # Etherpad (optionnel) ########################## - location / { - proxy_pass http://front:5080; - proxy_http_version 1.1; - 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; - proxy_set_header Connection ""; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } -} - -## -## BACKEND -## -server { - listen 80; - listen [::]:80; - server_name _; - - location / { - proxy_pass http://back:8080; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - } -} - -## -## ETHERPAD -## -server { - listen 80; - listen [::]:80; - server_name _; - - location / { - proxy_pass http://etherpad:9001; + location /pad/ { + proxy_pass http://etherpad:9001/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $host; } -} + + ########################## + # Front Angular + ########################## + location / { + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file