Сейчас, если я останавливаю сервис
db
, то
backend
и
frontend
продолжают работать.
name: app
services:
db:
container_name: db
restart: unless-stopped
image: mongo:7.0.12
hostname: mongodb
stop_grace_period: 5s
env_file: db.env
ports:
- 27017:27017
command:
- --auth
- -f
- /etc/mongod.conf
volumes:
- ./mongod.conf:/etc/mongod.conf:ro
- ./mongo/data:/data/db/:rw
- ./mongo/log:/var/log/mongodb/:rw
- ./usr/bin/mongorestore:/usr/bin/mongorestore:rw
- ./usr/bin/mongodump:/usr/bin/mongodump:rw
healthcheck:
test: [ "CMD", "mongosh", "--eval", "db.adminCommand('ping')" ]
interval: 5s
timeout: 5s
retries: 3
start_period: 5s
backend:
container_name: backend
restart: unless-stopped
image: localhost/backend
stop_grace_period: 3s
env_file: backend.env
depends_on:
db:
condition: service_healthy
restart: true
ports:
- 8443:8443
build:
context: .
dockerfile: backend.Dockerfile
secrets:
- GIT_AUTH_TOKEN
volumes:
- ./certs:/certs:ro
- ./usr/bin/mongorestore:/usr/bin/mongorestore:rw
- ./usr/bin/mongodump:/usr/bin/mongodump:rw
frontend:
container_name: frontend
restart: unless-stopped
image: localhost/frontend
stop_grace_period: 1s
depends_on:
- backend
build:
context: .
dockerfile: frontend.Dockerfile
secrets:
- GIT_AUTH_TOKEN
ports:
- 80:80
- 443:443
volumes:
- ./certs:/certs:ro
- ./nginx.conf:/etc/nginx/conf.d/wifer.lol.conf:ro
secrets:
GIT_AUTH_TOKEN:
file: git.txt