diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a74566c..aa827eb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,7 +20,7 @@ jobs: - name: Build and Push Docker image for Router uses: docker/build-push-action@v2 with: - context: ./nginx - file: ./nginx/Dockerfile + context: ./nginx/prod + file: ./nginx/prod/Dockerfile push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_ROUTER_REPO }}:latest diff --git a/.github/workflows/dev_deploy.yml b/.github/workflows/dev_deploy.yml index 8a7888d..9bdce71 100644 --- a/.github/workflows/dev_deploy.yml +++ b/.github/workflows/dev_deploy.yml @@ -20,7 +20,7 @@ jobs: - name: Build and Push Docker image for Router uses: docker/build-push-action@v2 with: - context: ./nginx - file: ./nginx/Dockerfile + context: ./nginx/dev + file: ./nginx/dev/Dockerfile push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/dev_${{ secrets.DOCKERHUB_ROUTER_REPO }}:latest diff --git a/nginx/Dockerfile b/nginx/dev/Dockerfile similarity index 100% rename from nginx/Dockerfile rename to nginx/dev/Dockerfile diff --git a/nginx/dev/default.conf b/nginx/dev/default.conf new file mode 100644 index 0000000..e6d1933 --- /dev/null +++ b/nginx/dev/default.conf @@ -0,0 +1,31 @@ +upstream frontend { + server frontend:5174; +} + +upstream backend { + server backend:3001; +} + +server { + listen 8080; + + location /api { + rewrite /backend/(.*) /$1 break; + proxy_pass http://backend; + } + + location /socket.io { + rewrite /backend/(.*) /$1 break; + proxy_pass http://backend; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + proxy_hide_header 'Access-Control-Allow-Origin'; + } + + location / { + proxy_pass http://frontend; + } + +} diff --git a/nginx/prod/Dockerfile b/nginx/prod/Dockerfile new file mode 100644 index 0000000..6597d48 --- /dev/null +++ b/nginx/prod/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx + +COPY ./default.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/nginx/default.conf b/nginx/prod/default.conf similarity index 100% rename from nginx/default.conf rename to nginx/prod/default.conf