Skip to content

Commit

Permalink
Fixing GitHub Actions Container build (#462)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mmckechney authored Jan 24, 2024
1 parent 8712b40 commit 73f6dbc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 39 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/container-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: container_build
on:
push:
branches:
- master
- '*'

pull_request:
branches:
Expand All @@ -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 }}
Expand All @@ -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: |
Expand Down
39 changes: 6 additions & 33 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 73f6dbc

Please sign in to comment.