Skip to content

Commit

Permalink
Use RID rather than QEMU to build WebAPI container image
Browse files Browse the repository at this point in the history
  • Loading branch information
YaSuenag committed Apr 10, 2024
1 parent abd9e6b commit da7a254
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/2-pre-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
permissions:
packages: write
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/4-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
permissions:
packages: write
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
Expand Down
5 changes: 3 additions & 2 deletions src/CarbonAware.WebApi/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
ARG TARGETARCH
WORKDIR /app

ENV DOTNET_ROLL_FORWARD LatestMajor
# Copy everything from source
COPY . ./
# Use implicit restore to build and publish
RUN dotnet publish CarbonAware.WebApi/src/CarbonAware.WebApi.csproj -c Release -o publish
RUN dotnet publish CarbonAware.WebApi/src/CarbonAware.WebApi.csproj -a $TARGETARCH -o publish
# Generate OpenAPI spec
WORKDIR /app/CarbonAware.WebApi/src
RUN dotnet tool restore && \
Expand Down

0 comments on commit da7a254

Please sign in to comment.