fix .net docker build

This commit is contained in:
alyssa 2025-05-18 13:19:20 +00:00
parent 0fa0070d41
commit e573e978da
5 changed files with 13 additions and 2 deletions

View file

@ -4,6 +4,7 @@
# Include project code and build files # Include project code and build files
!PluralKit.*/ !PluralKit.*/
!Myriad/ !Myriad/
!Serilog/
!.git !.git
!dashboard !dashboard
!crates/ !crates/

View file

@ -2,7 +2,9 @@ name: Build and push Docker image
on: on:
push: push:
paths: paths:
- '.github/workflows/docker.yml' - '.dockerignore'
- '.github/workflows/dotnet-docker.yml'
- 'ci/Dockerfile.dotnet'
- 'ci/dotnet-version.sh' - 'ci/dotnet-version.sh'
- 'Myriad/**' - 'Myriad/**'
- 'PluralKit.API/**' - 'PluralKit.API/**'
@ -23,6 +25,9 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }} password: ${{ secrets.CR_PAT }}
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
submodules: true
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" | sed 's|/|-|g' >> $GITHUB_ENV - run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" | sed 's|/|-|g' >> $GITHUB_ENV
- name: Extract Docker metadata - name: Extract Docker metadata
@ -41,6 +46,7 @@ jobs:
with: with:
# https://github.com/docker/build-push-action/issues/378 # https://github.com/docker/build-push-action/issues/378
context: . context: .
file: ci/Dockerfile.dotnet
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }} cache-from: type=registry,ref=ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }}

View file

@ -3,6 +3,7 @@ on:
push: push:
paths: paths:
- 'crates/**' - 'crates/**'
- '.dockerignore'
- '.github/workflows/rust.yml' - '.github/workflows/rust.yml'
- 'ci/Dockerfile.rust' - 'ci/Dockerfile.rust'
- 'ci/rust-docker-target.sh' - 'ci/rust-docker-target.sh'

View file

@ -10,6 +10,7 @@ COPY PluralKit.Bot/PluralKit.Bot.csproj /app/PluralKit.Bot/
COPY PluralKit.Core/PluralKit.Core.csproj /app/PluralKit.Core/ COPY PluralKit.Core/PluralKit.Core.csproj /app/PluralKit.Core/
COPY PluralKit.Tests/PluralKit.Tests.csproj /app/PluralKit.Tests/ COPY PluralKit.Tests/PluralKit.Tests.csproj /app/PluralKit.Tests/
COPY .git/ /app/.git COPY .git/ /app/.git
COPY Serilog/ /app/Serilog/
RUN dotnet restore PluralKit.sln RUN dotnet restore PluralKit.sln
# Copy the rest of the code and build # Copy the rest of the code and build

View file

@ -2,7 +2,9 @@ version: "3"
services: services:
bot: bot:
build: . build:
context: .
dockerfile: ci/Dockerfile.dotnet
command: ["bin/PluralKit.Bot.dll"] command: ["bin/PluralKit.Bot.dll"]
environment: environment:
- "PluralKit__Database=Host=db;Username=postgres;Password=postgres;Database=postgres" - "PluralKit__Database=Host=db;Username=postgres;Password=postgres;Database=postgres"