From 73f6dbcd39d35fa8e911967516ecddb1491b4963 Mon Sep 17 00:00:00 2001 From: Michael McKechney Date: Wed, 24 Jan 2024 15:28:32 -0500 Subject: [PATCH] Fixing GitHub Actions Container build (#462) Workflow modification to the triggering branches, updating the versions of the actions used, and changing the build platforms. In the Dockerfile, the changes involve cleaning up the build process and removing unnecessary commands. --- .github/workflows/container-build.yml | 12 ++++----- src/Dockerfile | 39 +++++---------------------- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/.github/workflows/container-build.yml b/.github/workflows/container-build.yml index cb5fe37b..7712102e 100644 --- a/.github/workflows/container-build.yml +++ b/.github/workflows/container-build.yml @@ -3,7 +3,7 @@ name: container_build on: push: branches: - - master + - '*' pull_request: branches: @@ -18,16 +18,16 @@ jobs: run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -37,7 +37,7 @@ jobs: uses: docker/build-push-action@v5 with: context: "{{defaultContext}}:src" - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 push: true provenance: false tags: | diff --git a/src/Dockerfile b/src/Dockerfile index 2a618d0e..71337a35 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -4,42 +4,15 @@ FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base WORKDIR /app FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build -WORKDIR /src - - -#The goofy "RUN true" is added because of bug: https://github.com/moby/moby/issues/37965 . Can be removed once this is fixed -COPY ["SqlBuildManager.Console/sbm.csproj", "SqlBuildManager.Console/"] -RUN true -COPY ["SqlBuildManager.Enterprise/SqlBuildManager.Enterprise.csproj", "SqlBuildManager.Enterprise/" ] -RUN true -COPY ["SqlBuildManager.Interfaces/SqlBuildManager.Interfaces.csproj", "SqlBuildManager.Interfaces/" ] -RUN true -COPY ["SqlBuildManager.Logging/SqlBuildManager.Logging.csproj", "SqlBuildManager.Logging/" ] -RUN true -COPY ["SqlSync.Connection/SqlSync.Connection.csproj", "SqlSync.Connection/" ] -RUN true -COPY ["SqlSync.Constants/SqlSync.Constants.csproj", "SqlSync.Constants/" ] -RUN true -COPY ["SqlSync.DbInformation/SqlSync.DbInformation.csproj", "SqlSync.DbInformation/" ] -RUN true -COPY ["SqlSync.ObjectScript/SqlSync.ObjectScript.csproj", "SqlSync.ObjectScript/" ] -RUN true -COPY ["SqlSync.SqlBuild/SqlSync.SqlBuild.csproj", "SqlSync.SqlBuild/" ] -RUN true -COPY ["SqlSync.SqlBuild/SqlSync.SqlBuild.csproj", "SqlSync.SqlBuild/SqlSync.SqlBuild.csproj" ] -RUN true -COPY ["SqlBuildManager.ScriptHandling/SqlBuildManager.ScriptHandling.csproj", "SqlBuildManager.ScriptHandling/"] - -#RUN true -#RUN dotnet restore "SqlBuildManager.Console/sbm.csproj" - COPY . . -WORKDIR "/src/SqlBuildManager.Console" -#RUN dotnet build "sbm.csproj" --configuration Release -f net8.0 -o /app/build -r linux-x64 --self-contained +WORKDIR "/SqlBuildManager.Console" + -FROM build AS publish -RUN dotnet publish "sbm.csproj" --configuration Release -f net8.0 -o /app/publish -r linux-x64 --self-contained +FROM build AS publish +RUN dotnet clean --configuration Release -f net8.0 +RUN dotnet nuget locals all --clear +RUN dotnet publish sbm.csproj --configuration Release -f net8.0 -o /app/publish --self-contained FROM base AS final WORKDIR /app