From e573e978da4ef7b9557f36c32b843b6dca051f9e Mon Sep 17 00:00:00 2001 From: alyssa Date: Sun, 18 May 2025 13:19:20 +0000 Subject: [PATCH] fix .net docker build --- .dockerignore | 1 + .github/workflows/dotnet-docker.yml | 8 +++++++- .github/workflows/rust-docker.yml | 1 + Dockerfile => ci/Dockerfile.dotnet | 1 + docker-compose.yml | 4 +++- 5 files changed, 13 insertions(+), 2 deletions(-) rename Dockerfile => ci/Dockerfile.dotnet (97%) diff --git a/.dockerignore b/.dockerignore index c4f2c30e..ee5756d6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,7 @@ # Include project code and build files !PluralKit.*/ !Myriad/ +!Serilog/ !.git !dashboard !crates/ diff --git a/.github/workflows/dotnet-docker.yml b/.github/workflows/dotnet-docker.yml index af20524a..9939320b 100644 --- a/.github/workflows/dotnet-docker.yml +++ b/.github/workflows/dotnet-docker.yml @@ -2,7 +2,9 @@ name: Build and push Docker image on: push: paths: - - '.github/workflows/docker.yml' + - '.dockerignore' + - '.github/workflows/dotnet-docker.yml' + - 'ci/Dockerfile.dotnet' - 'ci/dotnet-version.sh' - 'Myriad/**' - 'PluralKit.API/**' @@ -23,6 +25,9 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.CR_PAT }} - uses: actions/checkout@v2 + with: + submodules: true + - run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" | sed 's|/|-|g' >> $GITHUB_ENV - name: Extract Docker metadata @@ -41,6 +46,7 @@ jobs: with: # https://github.com/docker/build-push-action/issues/378 context: . + file: ci/Dockerfile.dotnet push: true tags: ${{ steps.meta.outputs.tags }} cache-from: type=registry,ref=ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }} diff --git a/.github/workflows/rust-docker.yml b/.github/workflows/rust-docker.yml index 293a2106..a46adf67 100644 --- a/.github/workflows/rust-docker.yml +++ b/.github/workflows/rust-docker.yml @@ -3,6 +3,7 @@ on: push: paths: - 'crates/**' + - '.dockerignore' - '.github/workflows/rust.yml' - 'ci/Dockerfile.rust' - 'ci/rust-docker-target.sh' diff --git a/Dockerfile b/ci/Dockerfile.dotnet similarity index 97% rename from Dockerfile rename to ci/Dockerfile.dotnet index dedc085d..c10952b3 100644 --- a/Dockerfile +++ b/ci/Dockerfile.dotnet @@ -10,6 +10,7 @@ COPY PluralKit.Bot/PluralKit.Bot.csproj /app/PluralKit.Bot/ COPY PluralKit.Core/PluralKit.Core.csproj /app/PluralKit.Core/ COPY PluralKit.Tests/PluralKit.Tests.csproj /app/PluralKit.Tests/ COPY .git/ /app/.git +COPY Serilog/ /app/Serilog/ RUN dotnet restore PluralKit.sln # Copy the rest of the code and build diff --git a/docker-compose.yml b/docker-compose.yml index d58f4c5c..18ddaa03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,9 @@ version: "3" services: bot: - build: . + build: + context: . + dockerfile: ci/Dockerfile.dotnet command: ["bin/PluralKit.Bot.dll"] environment: - "PluralKit__Database=Host=db;Username=postgres;Password=postgres;Database=postgres"