container: enable docker healthchecks

ref: !10681

Co-authored-by: naskya <m@naskya.net>
This commit is contained in:
Kyle Gordon 2024-03-17 02:24:40 +09:00 committed by naskya
parent 75f277f461
commit 8a5a6dcc45
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
2 changed files with 20 additions and 3 deletions

View file

@ -48,7 +48,7 @@ FROM docker.io/node:20-slim
WORKDIR /firefish
# Install runtime dependencies
RUN apt-get update && DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends zip unzip tini ffmpeg ca-certificates
RUN apt-get update && DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends zip unzip tini ffmpeg ca-certificates curl
RUN echo 'deb https://deb.debian.org/debian experimental main' | tee /etc/apt/sources.list
RUN apt-get update && DEBIAN_FRONTEND='noninteractive' apt-get --target-release experimental install -y --no-install-recommends libc6

View file

@ -6,8 +6,10 @@ services:
container_name: firefish_web
restart: unless-stopped
depends_on:
- db
- redis
db:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "3000:3000"
networks:
@ -19,6 +21,11 @@ services:
- ./custom:/firefish/custom:ro
- ./files:/firefish/files
- ./.config:/firefish/.config:ro
healthcheck:
test: curl -f http://localhost:3000 || exit 1
interval: 5s
timeout: 5s
retries: 5
redis:
restart: unless-stopped
@ -28,6 +35,11 @@ services:
- calcnet
volumes:
- ./redis:/data
healthcheck:
test: redis-cli ping
interval: 5s
timeout: 5s
retries: 5
db:
restart: unless-stopped
@ -39,6 +51,11 @@ services:
- .config/docker.env
volumes:
- ./db:/var/lib/postgresql/data
healthcheck:
test: pg_isready --user="$${POSTGRES_USER}" --dbname="$${POSTGRES_DB}"
interval: 5s
timeout: 5s
retries: 5
networks:
calcnet: