diff --git a/Dockerfile b/Dockerfile index c9c0dbf..d885d5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/li RUN cargo build --release FROM debian:bookworm-slim -RUN apt-get update && apt-get install -y ca-certificates libssl3 && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y ca-certificates libssl3 curl && rm -rf /var/lib/apt/lists/* COPY --from=builder /app/target/release/stellarsend /usr/local/bin/ EXPOSE 3000 CMD ["stellarsend"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index bcd3ff0..609642c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,15 @@ services: ports: ["3000:3000"] env_file: - .env - depends_on: [db] + depends_on: + db: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000/health"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 30s db: image: postgres:16-alpine environment: @@ -12,5 +20,11 @@ services: POSTGRES_USER: stellarsend POSTGRES_PASSWORD: password volumes: [pgdata:/var/lib/postgresql/data] + healthcheck: + test: ["CMD-SHELL", "pg_isready -U stellarsend -d stellarsend"] + interval: 5s + timeout: 5s + retries: 10 + start_period: 10s volumes: - pgdata: \ No newline at end of file + pgdata: