mirror of
https://github.com/alex289/CleanArchitecture.git
synced 2025-06-30 18:42:56 +00:00
fix: Docker build for arm and amd
This commit is contained in:
parent
633944e6fb
commit
6dc4517ea7
2
.github/workflows/dotnet.yml
vendored
2
.github/workflows/dotnet.yml
vendored
@ -57,7 +57,7 @@ jobs:
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
# platforms: linux/amd64,linux/arm64
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.DOCKER_IMAGE }}:latest
|
||||
|
10
Dockerfile
10
Dockerfile
@ -1,16 +1,18 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG TARGETARCH
|
||||
WORKDIR /app
|
||||
|
||||
# copy csproj and restore as distinct layers
|
||||
COPY . .
|
||||
RUN dotnet restore
|
||||
RUN dotnet restore -a $TARGETARCH
|
||||
|
||||
# copy everything else and build app
|
||||
COPY CleanArchitecture.Api/. ./CleanArchitecture.Api/
|
||||
WORKDIR /app/CleanArchitecture.Api
|
||||
RUN dotnet publish -c Release -o out
|
||||
RUN dotnet publish -c Release -o out -a $TARGETARCH
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
|
||||
ARG TARGETARCH
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/CleanArchitecture.Api/out ./
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user