add linux/arm/v7 ; improve build & runtime

This commit is contained in:
Robin C. Ladiges 2022-07-02 23:06:10 +02:00
parent 024cb4fe0a
commit e6b9ef0ada
No known key found for this signature in database
GPG Key ID: B494D3DF92661B99
2 changed files with 32 additions and 10 deletions

View File

@ -49,7 +49,7 @@ jobs:
name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: amd64,arm64
platforms: amd64,arm64,arm32
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
@ -70,6 +70,6 @@ jobs:
file : ./Dockerfile
tags : ${{ steps.meta.outputs.tags }}
labels : ${{ steps.meta.outputs.labels }}
platforms : linux/amd64,linux/arm64
platforms : linux/amd64,linux/arm/v7,linux/arm64/v8
cache-from : type=gha,scope=${{ github.workflow }}
cache-to : type=gha,scope=${{ github.workflow }},mode=max

View File

@ -1,29 +1,51 @@
################################################################################
################################################################## build ###
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build
FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:6.0 as build
WORKDIR /app/
COPY ./Server/ ./Server/
COPY ./Shared/ ./Shared/
RUN dotnet publish ./Server/Server.csproj -c Release -o ./out/
ARG TARGETARCH
# Download NuGet dependencies
RUN dotnet restore \
./Server/Server.csproj \
-r debian.11-`echo $TARGETARCH | sed 's@^amd@x@'` \
;
# Build application binary
RUN dotnet publish \
./Server/Server.csproj \
-r debian.11-`echo $TARGETARCH | sed 's@^amd@x@'` \
-c Release \
-o ./out/ \
--no-restore \
--self-contained \
-p:publishSingleFile=true \
;
################################################################## build ###
################################################################################
################################################################ runtime ###
FROM mcr.microsoft.com/dotnet/runtime:6.0 as runtime
FROM debian:11-slim as runtime
WORKDIR /data/
# Download & install additional runtime dependencies
RUN apt-get update \
&& apt-get install -y libicu67 \
&& rm -rf /var/lib/apt/lists/* \
;
# Copy application binary from build stage
COPY --from=build /app/out/ /app/
ENTRYPOINT [ "dotnet", "/app/Server.dll" ]
EXPOSE 1027/tcp
VOLUME /data/
ENTRYPOINT [ "/app/Server" ]
EXPOSE 1027/tcp
WORKDIR /data/
VOLUME /data/
################################################################ runtime ###
################################################################################