heavyrain 1 week ago
parent
commit
27b589daed
2 changed files with 9 additions and 10 deletions
  1. 7 6
      docker-compose.yml
  2. 2 4
      nginx/nginx.conf

+ 7 - 6
docker-compose.yml

@@ -1,29 +1,30 @@
 services:
 services:
   
   
   frontend:
   frontend:
+    container_name: frontend
     image: trane-tech-energy-strategy-optimization-platform-frontend:v1.0
     image: trane-tech-energy-strategy-optimization-platform-frontend:v1.0
-    # build:
-    #   context: .
-    #   dockerfile: ./Dockerfile
     ports:
     ports:
       - 8091:80
       - 8091:80
     restart: unless-stopped
     restart: unless-stopped
 
 
   backend:
   backend:
+    container_name: backend
     image: trane-tech-energy-strategy-optimization-platform-backend:v1.0
     image: trane-tech-energy-strategy-optimization-platform-backend:v1.0
-    # build:
-    #   context: .
-    #   dockerfile: ./Dockerfile
     ports:
     ports:
       - 8092:8082
       - 8092:8082
     restart: unless-stopped
     restart: unless-stopped
 
 
   nginx:
   nginx:
+    container_name: nginx
     image: nginx:latest
     image: nginx:latest
     volumes:
     volumes:
       - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
       - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
     ports:
     ports:
       - 80:80
       - 80:80
+      - 443:443
+    depends_on:
+      - frontend
+      - backend
 
 
 networks:
 networks:
   default:
   default:

+ 2 - 4
nginx/nginx.conf

@@ -1,18 +1,16 @@
 server {
 server {
     listen 80;
     listen 80;
     
     
-    # Frontend route
     location / {
     location / {
-        proxy_pass http://frontend:8091;
+        proxy_pass http://frontend:80;  
         proxy_set_header Host $host;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header X-Forwarded-Proto $scheme;
     }
     }
 
 
-    # Backend API route
     location /api/ {
     location /api/ {
-        proxy_pass http://backend:8092;
+        proxy_pass http://backend:8082;
         proxy_set_header Host $host;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;