Skip to content

Commit

Permalink
make springBankApp/docker-compose.yml work
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Feb 21, 2024
1 parent 10ef8ae commit 35982ae
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions springBank/springBankApp/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ services:
working_dir: /app
volumes:
- .:/app
- ~/.m2/repository:/root/.m2/repository # Mount Maven local repository
ports:
- "9999:9999"
# expose:
# - "9999"
environment:
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/spring_bank
- SPRING_DATASOURCE_USERNAME=root
Expand All @@ -19,8 +18,12 @@ services:
- SPRING_JPA_HIBERNATE_DDL_AUTO=create # Set the Hibernate ddl-auto property here
- SPRING_JPA_GENERATE_DDL=true
- SERVER_PORT=9999
- SPRING_REDIS_HOST=redis # Set Redis host
- SPRING_REDIS_PORT=6379
- REDIS_URL=redis://redis:6379
depends_on:
- mysql
- redis
command: mvn clean spring-boot:run -DskipTests

app2:
Expand All @@ -29,10 +32,9 @@ services:
working_dir: /app
volumes:
- .:/app
- ~/.m2/repository:/root/.m2/repository # Mount Maven local repository
ports:
- "9998:9998"
# expose:
# - "9998"
environment:
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/spring_bank
- SPRING_DATASOURCE_USERNAME=root
Expand All @@ -42,20 +44,25 @@ services:
- SPRING_JPA_HIBERNATE_DDL_AUTO=create # Set the Hibernate ddl-auto property here
- SPRING_JPA_GENERATE_DDL=true
- SERVER_PORT=9998
- SPRING_REDIS_HOST=redis # Set Redis host
- SPRING_REDIS_PORT=6379
- REDIS_URL=redis://redis:6379
depends_on:
- mysql
- redis
command: mvn clean spring-boot:run -DskipTests

# nginx:
# image: nginx
# restart: always
# ports:
# - "8080:80"
# volumes:
# - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
# depends_on:
# - app1
# - app2
nginx:
image: nginx
restart: always
ports:
- "8080:8080"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/index.html:/app/html:ro
depends_on:
- app1
- app2

mysql:
image: mysql:5.7
Expand All @@ -68,6 +75,11 @@ services:
- "3306:3306"
volumes:
- mysql-data:/var/lib/mysql
redis:
image: redis:latest
restart: always
ports:
- "6379:6379" # Expose Redis port

volumes:
mysql-data:
mysql-data:

0 comments on commit 35982ae

Please sign in to comment.