-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove arm64 platform build job (#92)
* add BUILDPLATFORM and TARGETARCH envs * reference docker compose file in tagger project file * remove linux/arm64/v8 platform refactoring publish-containers action
- Loading branch information
Showing
4 changed files
with
29 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,21 +3,20 @@ name: Publish to GitHub container registry | |
on: | ||
push: | ||
branches: [ "master" ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
|
||
jobs: | ||
publish-containers: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- linux/amd64 | ||
- linux/arm64/v8 | ||
include: | ||
project: | ||
- dockerfile: ./src/ImageHosting.Storage.WebApi/Dockerfile | ||
image: ghcr.io/baklanov-soft/image-hosting-storage-webapi | ||
- dockerfile: ./src/ImageHosting.Storage.Tagger/Dockerfile | ||
|
@@ -26,30 +25,18 @@ jobs: | |
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Install the cosign tool except on PR | ||
# https://github.com/sigstore/cosign-installer | ||
- name: Install cosign | ||
if: github.event_name != 'pull_request' | ||
uses: sigstore/[email protected] | ||
with: | ||
cosign-release: 'v2.2.2' | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
# Set up BuildKit Docker container builder to be able to build | ||
# multi-platform images and export cache | ||
# https://github.com/docker/setup-buildx-action | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: ${{ matrix.platform }} | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
|
@@ -67,34 +54,19 @@ jobs: | |
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ matrix.image }} | ||
images: ${{ matrix.project.image }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v5 | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ${{ matrix.dockerfile }} | ||
file: ${{ matrix.project.dockerfile }} | ||
platforms: ${{ matrix.platform }} | ||
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 | ||
|
||
# Sign the resulting Docker image digest except on PRs. | ||
# This will only write to the public Rekor transparency log when the Docker | ||
# repository is public to avoid leaking data. If you would like to publish | ||
# transparency data even for private images, pass --force to cosign below. | ||
# https://github.com/sigstore/cosign | ||
- name: Sign the published Docker image | ||
if: ${{ github.event_name != 'pull_request' }} | ||
env: | ||
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable | ||
TAGS: ${{ steps.meta.outputs.tags }} | ||
DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
# This step uses the identity token to provision an ephemeral certificate | ||
# against the sigstore community Fulcio instance. | ||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. | ||
|
||
# This stage is used when running from VS in fast mode (Default for Debug configuration) | ||
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/runtime:8.0 AS base | ||
USER app | ||
WORKDIR /app | ||
|
||
|
||
# This stage is used to build the service project | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||
ARG BUILD_CONFIGURATION=Release | ||
ARG TARGETARCH | ||
WORKDIR /src | ||
COPY ["src/ImageHosting.Storage.Tagger/ImageHosting.Storage.Tagger.csproj", "src/ImageHosting.Storage.Tagger/"] | ||
COPY ["src/ImageHosting.Storage.Infrastructure/ImageHosting.Storage.Infrastructure.csproj", "src/ImageHosting.Storage.Infrastructure/"] | ||
COPY ["src/ImageHosting.Storage.Application/ImageHosting.Storage.Application.csproj", "src/ImageHosting.Storage.Application/"] | ||
COPY ["src/ImageHosting.Storage.Domain/ImageHosting.Storage.Domain.csproj", "src/ImageHosting.Storage.Domain/"] | ||
RUN dotnet restore "./src/ImageHosting.Storage.Tagger/ImageHosting.Storage.Tagger.csproj" | ||
RUN dotnet restore "./src/ImageHosting.Storage.Tagger/ImageHosting.Storage.Tagger.csproj" -a $TARGETARCH | ||
COPY . . | ||
WORKDIR "/src/src/ImageHosting.Storage.Tagger" | ||
RUN dotnet build "./ImageHosting.Storage.Tagger.csproj" -c $BUILD_CONFIGURATION -o /app/build | ||
RUN dotnet build "./ImageHosting.Storage.Tagger.csproj" -c $BUILD_CONFIGURATION -o /app/build -a $TARGETARCH | ||
|
||
|
||
# This stage is used to publish the service project to be copied to the final stage | ||
FROM build AS publish | ||
ARG BUILD_CONFIGURATION=Release | ||
RUN dotnet publish "./ImageHosting.Storage.Tagger.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false | ||
RUN dotnet publish "./ImageHosting.Storage.Tagger.csproj" -c $BUILD_CONFIGURATION -o /app/publish -p:UseAppHost=false -a $TARGETARCH | ||
|
||
|
||
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) | ||
FROM base AS final | ||
WORKDIR /app | ||
COPY --from=publish /app/publish . | ||
ENTRYPOINT ["dotnet", "ImageHosting.Storage.Tagger.dll"] | ||
ENTRYPOINT ["dotnet", "ImageHosting.Storage.Tagger.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. | ||
|
||
# This stage is used when running from VS in fast mode (Default for Debug configuration) | ||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0 AS base | ||
USER app | ||
WORKDIR /app | ||
EXPOSE 8080 | ||
|
||
|
||
# This stage is used to build the service project | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||
ARG BUILD_CONFIGURATION=Release | ||
ARG TARGETARCH | ||
WORKDIR /src | ||
COPY ["src/ImageHosting.Storage.WebApi/ImageHosting.Storage.WebApi.csproj", "src/ImageHosting.Storage.WebApi/"] | ||
COPY ["src/ImageHosting.Storage.Application/ImageHosting.Storage.Application.csproj", "src/ImageHosting.Storage.Application/"] | ||
COPY ["src/ImageHosting.Storage.Domain/ImageHosting.Storage.Domain.csproj", "src/ImageHosting.Storage.Domain/"] | ||
COPY ["src/ImageHosting.Storage.Infrastructure/ImageHosting.Storage.Infrastructure.csproj", "src/ImageHosting.Storage.Infrastructure/"] | ||
RUN dotnet restore "./src/ImageHosting.Storage.WebApi/ImageHosting.Storage.WebApi.csproj" | ||
RUN dotnet restore "./src/ImageHosting.Storage.WebApi/ImageHosting.Storage.WebApi.csproj" -a $TARGETARCH | ||
COPY . . | ||
WORKDIR "/src/src/ImageHosting.Storage.WebApi" | ||
RUN dotnet build "./ImageHosting.Storage.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build | ||
RUN dotnet build "./ImageHosting.Storage.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build -a $TARGETARCH | ||
|
||
|
||
# This stage is used to publish the service project to be copied to the final stage | ||
FROM build AS publish | ||
ARG BUILD_CONFIGURATION=Release | ||
RUN dotnet publish "./ImageHosting.Storage.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false | ||
RUN dotnet publish "./ImageHosting.Storage.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish -p:UseAppHost=false -a $TARGETARCH | ||
|
||
|
||
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) | ||
FROM base AS final | ||
WORKDIR /app | ||
COPY --from=publish /app/publish . | ||
ENTRYPOINT ["dotnet", "ImageHosting.Storage.WebApi.dll"] | ||
ENTRYPOINT ["dotnet", "ImageHosting.Storage.WebApi.dll"] |