@@ -4,57 +4,88 @@ services:
44 database :
55 image : postgres:13
66 restart : unless-stopped
7- container_name : example-api -database
7+ container_name : ${COMPOSE_PROJECT_NAME} -database
88 ports :
9- - " 5432 :5432"
9+ - " ${DB_PORT} :5432"
1010 environment :
1111 POSTGRES_USER : ${DB_USERNAME}
1212 POSTGRES_PASSWORD : ${DB_PASSWORD}
13- POSTGRES_DB : example_api
14- TZ : America/Sao_Paulo
15- PGTZ : America/Sao_Paulo
13+ POSTGRES_DB : ${DB_NAME}
14+ TZ : ${TIMEZONE}
15+ PGTZ : ${TIMEZONE}
1616 volumes :
17- - . /.volumes/database:/var/lib/postgresql/data
17+ - ~ /.volumes/database/postgresql :/var/lib/postgresql/data
1818 networks :
19- - example-api
19+ - spring-boot- example-network
2020 tty : true
2121
2222 api :
2323 build :
2424 context : ../api
2525 dockerfile : ../api/docker/Dockerfile.prod
26- image : throyer/example-api :latest
26+ image : throyer/springboot/spring-boot- example-network :latest
2727 platform : linux/x86_64
2828 restart : unless-stopped
29- container_name : example -api
29+ container_name : ${COMPOSE_PROJECT_NAME} -api
3030 links :
3131 - database
3232 ports :
3333 - 8080:80
34- depends_on :
35- - database
3634 environment :
37- DB_URL : ${DB_URL}
35+
36+ # database
37+ DB_PORT : ${DB_PORT}
38+ DB_NAME : ${DB_NAME}
39+ DB_HOST : ${DB_HOST}
3840 DB_USERNAME : ${DB_USERNAME}
3941 DB_PASSWORD : ${DB_PASSWORD}
42+ DB_SHOW_SQL : ${DB_SHOW_SQL}
43+ DB_MAX_CONNECTIONS : ${DB_MAX_CONNECTIONS}
44+
45+ # security
46+ TOKEN_SECRET : ${TOKEN_SECRET}
47+ TOKEN_EXPIRATION_IN_HOURS : ${TOKEN_EXPIRATION_IN_HOURS}
48+ REFRESH_TOKEN_EXPIRATION_IN_DAYS : ${REFRESH_TOKEN_EXPIRATION_IN_DAYS}
49+ MINUTES_TO_EXPIRE_RECOVERY_CODE : ${MINUTES_TO_EXPIRE_RECOVERY_CODE}
50+ MAX_REQUESTS_PER_MINUTE : ${MAX_REQUESTS_PER_MINUTE}
51+
52+ # smtp
53+ SMTP_HOST : ${SMTP_HOST}
54+ SMTP_PORT : ${SMTP_PORT}
55+ SMTP_USERNAME : ${SMTP_USERNAME}
56+ SMTP_PASSWORD : ${SMTP_PASSWORD}
57+
58+ # swagger
59+ SWAGGER_URL : ${SWAGGER_URL}
60+ SWAGGER_USERNAME : ${SWAGGER_USERNAME}
61+ SWAGGER_PASSWORD : ${SWAGGER_PASSWORD}
4062 networks :
41- - example-api
63+ - spring-boot- example-network
4264 tty : true
43- entrypoint : " dockerize -wait tcp://database:5432 -timeout 20s java -jar api.jar"
65+ entrypoint : [
66+ " dockerize" ,
67+ " -wait" ,
68+ " tcp://database:${DB_PORT}" ,
69+ " -timeout" ,
70+ " 20s" ,
71+ " java" ,
72+ " -jar" ,
73+ " api.jar"
74+ ]
4475
4576 # web:
77+ # image: throyer/springboot/example-web:latest
4678 # build:
4779 # context: ../web
4880 # dockerfile: ../web/docker/Dockerfile.prod
49- # image: throyer/example-api-front-end:latest
5081 # restart: unless-stopped
51- # container_name: example-api-front-end
82+ # container_name: ${COMPOSE_PROJECT_NAME}-web
5283 # ports:
53- # - "8082:8080 "
84+ # - "8082:80 "
5485 # networks:
55- # - example-api
86+ # - spring-boot- example-network
5687 # tty: true
5788
5889networks :
59- example-api :
90+ spring-boot- example-network :
6091 driver : bridge
0 commit comments