From 672d7a2d3c5697572b69e155a5346e5a98830641 Mon Sep 17 00:00:00 2001 From: Awiteb Date: Tue, 23 Jul 2024 00:25:06 +0300 Subject: [PATCH] chore: Docker improvments Replace `as` with `AS` - Remove `version` from `docker-compose.yml` - Add database configration to oxidetalis environment - Add `healthcheck` for the database Signed-off-by: Awiteb --- crates/oxidetalis/Dockerfile | 2 +- docker-compose.yml | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/oxidetalis/Dockerfile b/crates/oxidetalis/Dockerfile index de75af1..35f1784 100644 --- a/crates/oxidetalis/Dockerfile +++ b/crates/oxidetalis/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.70.0-slim-bullseye as builder +FROM rust:1.70.0-slim-bullseye AS builder WORKDIR /builder diff --git a/docker-compose.yml b/docker-compose.yml index 61d0566..0b9da08 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3' services: oxidetalis: container_name: oxidetalis @@ -6,7 +5,17 @@ services: context: ./ dockerfile: ./crates/oxidetalis/Dockerfile environment: + # Logging level + - RUST_LOG=info - OXIDETALIS_CONFIG=/app/config.toml + # In docker host + - OXIDETALIS_SERVER_HOST=0.0.0.0 + # Connect to the below db + - OXIDETALIS_DB_HOST=db + - OXIDETALIS_DB_PORT=5432 + - OXIDETALIS_DB_USER=oxidetalis + - OXIDETALIS_DB_PASSWORD=oxidetalis + - OXIDETALIS_DB_NAME=oxidetalis_db ports: - 127.0.0.1:7294:7294 depends_on: @@ -20,6 +29,12 @@ services: POSTGRES_USER: oxidetalis POSTGRES_PASSWORD: oxidetalis POSTGRES_DB: oxidetalis_db + healthcheck: + test: ["CMD-SHELL", "pg_isready", "-d", "db_prod"] + interval: 30s + timeout: 60s + retries: 5 + start_period: 80s # This for devlopment only ports: - 127.0.0.1:5432:5432