-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker-compose.test.yml
156 lines (149 loc) · 4.37 KB
/
docker-compose.test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
version: '2.3'
networks:
app_external_network:
app_internal_network:
internal: true
services:
app_web:
build:
context: ./
#dockerfile: Dockerfile.web
dockerfile: ${DOCKERFILE_PATH}
args:
- BUILD_ENV=${BUILD_ENV}
- CLIENT_LOCALE=${CLIENT_LOCALE}
- API_CLIENT_ID=${app_API_CLIENT_ID}
- API_CLIENT_SECRET=${app_API_CLIENT_SECRET}
#image: monogramm/ngxp-seed:latest-test
image: ${IMAGE_NAME}
container_name: app_web
# [TODO] Enable auto-restart when production-ready
#restart: always
ports:
- "8080:80"
- "8443:443"
networks:
- app_internal_network
- app_external_network
depends_on:
- app_api
volumes:
- ${APP_HOME}/nginx/logs:/var/logs/nginx
# Mount SSL keys for SSL
#- ./nginx/keys/:/etc/nginx/keys
# Mount custom NGinx config
- ./nginx/conf.d:/etc/nginx/conf.d:ro
app_api:
image: monogramm/spring-rest-api-starter:latest
container_name: app_api
# [TODO] Enable auto-restart when production-ready
#restart: always
healthcheck:
test: CMD curl -v --silent http://localhost:${APP_SERVER_PORT}/${APP_SERVER_CONTEXT_PATH}/health 2>&1 | grep UP
interval: 1m30s
timeout: 10s
retries: 3
#start_period: 40s
ports:
- "8081:${APP_SERVER_PORT}"
networks:
- app_internal_network
- app_external_network
depends_on:
- app_db
- app_mailer
volumes:
- ${APP_HOME}/backend/logs:/srv/app/logs
- ${APP_HOME}/backend/keys:/srv/app/keys
- ${APP_HOME}/backend/config:/srv/app/config
- ${APP_HOME}/backend/data:/srv/app/data
# If you want, you can sync time & timezone with host
#- /etc/localtime:/etc/localtime:ro
#- /etc/timezone:/etc/timezone:ro
environment:
# Application configuration
- APP_SERVER_PORT=${APP_SERVER_PORT}
- APP_SERVER_CONTEXT_PATH=/${APP_SERVER_CONTEXT_PATH}
- APP_TITLE=${APP_TITLE}
- APP_DOMAIN_NAME=${APP_DOMAIN_NAME}
- APP_ADMIN_PASSWORD=${APP_ADMIN_PASSWORD}
- APP_SIGNING_KEY=
- APP_SIGNING_KEYPAIR_PASS=${APP_SIGNING_KEYPAIR_PASS}
- APP_DEMO_DATA=true
# Database configuration (PostgreSQL)
- DB_PLATFORM=postgresql
- DB_HOST=app_db
- DB_NAME=${APP_DB_NAME}
- DB_USER=${APP_DB_USER}
- DB_PASSWORD=${APP_DB_PASSWORD}
# Mail configuration
- MAIL_HOST=app_mailer
- MAIL_PORT=1025
- MAIL_PROTOCOL=smtp
- MAIL_USER=${APP_SMTP_USER}
- MAIL_PASSWORD=${APP_SMTP_PASSWD}
- MAIL_SSL=false
- MAIL_STARTTLS=false
# Wait for it...
- WAIT_FOR=app_db:5432
app_db:
image: postgres:10-alpine
container_name: app_db
restart: always
healthcheck:
test: ["CMD", "pg_isready", "-U", "${APP_DB_USER}"]
expose:
- '5432'
#ports:
# - "55432:5432"
networks:
- app_internal_network
volumes:
- /srv/spring_rest_api_starter/postgres/data:/var/lib/postgresql/data
# If you want, you can sync time & timezone with host
#- /etc/localtime:/etc/localtime:ro
#- /etc/timezone:/etc/timezone:ro
environment:
- POSTGRES_DB=${APP_DB_NAME}
- POSTGRES_USER=${APP_DB_USER}
- POSTGRES_PASSWORD=${APP_DB_PASSWORD}
# Test services (do not use in production)
# https://docs.docker.com/docker-hub/builds/automated-testing/
sut:
build:
context: ./docker/test
dockerfile: Dockerfile
command: sh /docker_test.sh
networks:
- app_internal_network
- app_external_network
depends_on:
app_api:
condition: service_started
environment:
- DOCKER_TEST_CONTAINER=app_web
#- DOCKER_WEB_CONTAINER=app_web
#- DOCKER_WEB_PORT=80
#- DOCKER_WEB_HEALTH_API=${APP_SERVER_CONTEXT_PATH}/login
volumes_from:
- app_api
# If you want, you can sync time & timezone with host
#volumes:
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
app_mailer:
image: sj26/mailcatcher:latest
hostname: app_mailer
container_name: app_mailer
restart: always
expose:
- '1025'
ports:
- "1080:1080"
networks:
- app_internal_network
- app_external_network
# If you want, you can sync time & timezone with host
#volumes:
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro