mirror of
https://github.com/alex289/CleanArchitecture.git
synced 2025-07-01 02:52: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
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
# platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
${{ env.DOCKER_IMAGE }}:latest
|
${{ 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
|
WORKDIR /app
|
||||||
|
|
||||||
# copy csproj and restore as distinct layers
|
# copy csproj and restore as distinct layers
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN dotnet restore
|
RUN dotnet restore -a $TARGETARCH
|
||||||
|
|
||||||
# copy everything else and build app
|
# copy everything else and build app
|
||||||
COPY CleanArchitecture.Api/. ./CleanArchitecture.Api/
|
COPY CleanArchitecture.Api/. ./CleanArchitecture.Api/
|
||||||
WORKDIR /app/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
|
WORKDIR /app
|
||||||
COPY --from=build /app/CleanArchitecture.Api/out ./
|
COPY --from=build /app/CleanArchitecture.Api/out ./
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user