chore(Dockerfile): remove unused COPY command for db directory

refactor(docker-compose.yml): add healthcheck to ensure database service is healthy before starting the server
feat(docker-compose.yml): add condition to wait for database service to be ready before starting the server
This commit is contained in:
Mateleo 2024-11-22 13:39:30 +01:00
parent bcddfd279d
commit aecc164a7c
2 changed files with 7 additions and 2 deletions

View File

@ -8,7 +8,6 @@ RUN dotnet restore "src/DiIiS-NA/Blizzless.csproj"
# Copy the rest of the project files and build the application
COPY ["src/", "src/"]
COPY ["db/", "db/"]
WORKDIR "/app/src/DiIiS-NA"
RUN dotnet publish "Blizzless.csproj" -c Release --runtime linux-x64 --self-contained true -o /app/publish

View File

@ -5,7 +5,8 @@ services:
dockerfile: Dockerfile
container_name: diiis-na-server
depends_on:
- db
- db:
condition: service_healthy
db:
image: postgres:17
@ -17,6 +18,11 @@ services:
volumes:
- db-data:/var/lib/postgresql/data
- ./db/initdb:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
volumes:
db-data: