From 8203e983d5cc177b61eb7033daae1a896948ea50 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 28 Dec 2021 16:41:27 +0000 Subject: [PATCH] build(docker): define restart policy --- .env.example | 3 +++ docker-compose.yaml | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index bfe3ff7..fb543f8 100644 --- a/.env.example +++ b/.env.example @@ -5,3 +5,6 @@ INTEGROMAT_WEBHOOK_URL= # Which environment is running? This should be "development" or "production". # NODE_ENV=development NODE_ENV=production + +# DOCKER_RESTART_POLICY=no +DOCKER_RESTART_POLICY=unless-stopped diff --git a/docker-compose.yaml b/docker-compose.yaml index 221f4a5..5dea1b5 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -11,7 +11,8 @@ services: condition: service_started ports: - "${DOCKER_WEB_PORT:-127.0.0.1:80}:80" - restart: unless-stopped + restart: "${DOCKER_RESTART_POLICY:-unless-stopped}" + stop_grace_period: 3s php: build: @@ -25,7 +26,8 @@ services: depends_on: mysql: condition: service_healthy - restart: unless-stopped + restart: "${DOCKER_RESTART_POLICY:-unless-stopped}" + stop_grace_period: 3s mysql: image: mariadb:10 @@ -33,11 +35,12 @@ services: - "${DOCKER_MYSQL_VOLUME:-./db-data:/var/lib/mysql}" - ./tools/assets/development:/docker-entrypoint-initdb.d env_file: - - .docker.env + - .env healthcheck: test: ["CMD-SHELL", "bash", "-c", "echo > /dev/tcp/localhost/3306"] interval: 1s - restart: unless-stopped + restart: "${DOCKER_RESTART_POLICY:-unless-stopped}" + stop_grace_period: 3s volumes: assets: