From 083811e58ee4577dcdb53c0b7c8a4336ed328e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E4=B8=89?= Date: Tue, 17 Sep 2024 23:49:03 +0800 Subject: [PATCH] chore: add docker --- .github/workflows/build.yaml | 50 ++++++++++++++++++++++++++++++++++++ Dockerfile | 11 ++++++++ 2 files changed, 61 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..de4b680 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,50 @@ +name: Docker + +on: + push: + branches: + - '**' + tags: + - '**' + paths-ignore: + - '/README.md' + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: | + ghcr.io/${{ github.repository }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to ghcr.io + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..156dfd2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +COPY "." "/src" +WORKDIR "/src" +RUN dotnet build --configuration Release + +FROM ghcr.io/featuredcontainers/wine-dotnet:main +COPY --from=builder /src/bin/Release/net7.0/ /app +ENV WINEARCH=win32 +RUN winetricks gdiplus && \ + rm -rf /root/.cache +ENTRYPOINT [ "wine" "/dotnet/win32/dotnet.exe" "/app/EorzeaMapExtractor.Cli.dll" ]