From 58f4448438220986757eb9c499c65eec690915b7 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Thu, 16 Nov 2023 18:48:29 +0100 Subject: [PATCH] feat: add config to docker --- .pre-commit-config.yaml | 1 + Server/Dockerfile | 7 +++--- Server/docker-compose.yml | 52 ++++++++++++++++++++++----------------- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f66be6..e0303ff 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,3 +21,4 @@ repos: rev: v2.12.0 hooks: - id: hadolint-docker + args: [--ignore, SC2086] diff --git a/Server/Dockerfile b/Server/Dockerfile index af03a37..54c4c82 100644 --- a/Server/Dockerfile +++ b/Server/Dockerfile @@ -7,17 +7,16 @@ ENV TZ=Etc/UTC ENV DOTNET_TieredPGO=1 ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 -RUN echo "Target: $TARGETARCH" -RUN echo "Build: $BUILDPLATFORM" +RUN echo "Target: $TARGETARCH" && echo "Build: $BUILDPLATFORM" WORKDIR /src COPY ["Wonderking/Wonderking.csproj", "Wonderking/"] COPY ["Server/Server.csproj", "Server/"] -RUN dotnet restore "Wonderking/Wonderking.csproj" -a $TARGETARCH -RUN dotnet restore "Server/Server.csproj" -a $TARGETARCH +RUN dotnet restore "Wonderking/Wonderking.csproj" -a $TARGETARCH && dotnet restore "Server/Server.csproj" -a $TARGETARCH COPY . . FROM build AS publish RUN dotnet publish "Server/Server.csproj" -c Release -a $TARGETARCH --no-restore -f net8.0 -o /app +COPY ../config /app/config FROM base AS final WORKDIR /app diff --git a/Server/docker-compose.yml b/Server/docker-compose.yml index 657f148..18f2a41 100644 --- a/Server/docker-compose.yml +++ b/Server/docker-compose.yml @@ -1,44 +1,52 @@ -services: +services: server: container_name: continuity-server image: continuity:latest restart: always depends_on: - - db + - db environment: - - ENVIRONMENT=Development - - Testing:CreateAccountOnLogin=true - - DB:Host=db - - DB:Port=5432 - - DB:Username=continuity - - DB:Password=continuity - - Game:Data:Path=/app/data/ + - ENVIRONMENT=Development + - Testing:CreateAccountOnLogin=true + - DB:Host=db + - DB:Port=5432 + - DB:Username=continuity + - DB:Password=continuity + - Game:Data:Path=/app/data/ networks: - - continuity + - continuity ports: - - "10001:10001" + - 10001:10001 volumes: - - type: bind - source: ../wk-data - target: /app/data - read_only: true + - type: bind + source: ../wk-data + target: /app/data + read_only: true + - type: bind + source: ../wk-logs + target: /app/logs + read_only: false + - type: bind + source: ../config + target: /app/config + read_only: true db: container_name: continuity-db image: postgres:16.1-alpine restart: always environment: - - POSTGRES_USER=continuity - - POSTGRES_DB=continuity - - POSTGRES_PASSWORD=continuity + - POSTGRES_USER=continuity + - POSTGRES_DB=continuity + - POSTGRES_PASSWORD=continuity networks: - - continuity + - continuity ports: - - "5432:5432" + - 5432:5432 volumes: - - db-data:/var/lib/postgresql/data + - db-data:/var/lib/postgresql/data healthcheck: - test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ] + test: [CMD-SHELL, 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}'] interval: 10s timeout: 3s retries: 3