New attempt
This commit is contained in:
@@ -65,6 +65,9 @@ jobs:
|
|||||||
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print tolower($2)}') >> $GITHUB_OUTPUT
|
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print tolower($2)}') >> $GITHUB_OUTPUT
|
||||||
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
|
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
@@ -72,7 +75,6 @@ jobs:
|
|||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
platforms: |
|
platforms: |
|
||||||
linux/amd64
|
linux/amd64
|
||||||
linux/arm64
|
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
${{ env.GITEA_INSTANCE_URL }}/${{ steps.meta.outputs.REPO_OWNER }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
|
${{ env.GITEA_INSTANCE_URL }}/${{ steps.meta.outputs.REPO_OWNER }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
|
||||||
|
|||||||
38
Dockerfile
38
Dockerfile
@@ -1,21 +1,35 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
FROM mcr.microsoft.com/dotnet/runtime-deps:7.0-alpine AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim-amd64 AS build
|
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
|
||||||
WORKDIR /src
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG TARGETOS
|
ARG BUILDPLATFORM
|
||||||
RUN arch=$TARGETARCH \
|
|
||||||
&& if [ "$arch" = "amd64" ]; then arch="x64"; fi \
|
WORKDIR /src
|
||||||
&& echo $TARGETOS-$arch > /tmp/rid
|
|
||||||
COPY *.csproj .
|
COPY *.csproj .
|
||||||
RUN dotnet restore -r $(cat /tmp/rid)
|
RUN dotnet restore -r
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src"
|
WORKDIR "/src"
|
||||||
RUN dotnet publish -c Release -o /app -r $(cat /tmp/rid) --self-contained false --no-restore
|
RUN dotnet build -c Release -o /app/build -a $TARGETARCH
|
||||||
|
|
||||||
FROM base AS final
|
FROM build AS publish
|
||||||
|
RUN dotnet public -c Release -o /app/publish \
|
||||||
|
--self-contained true \
|
||||||
|
/p:PublishTrimmed=true \
|
||||||
|
/p:PublishSingleFile=true \
|
||||||
|
-a $TARGETARCH
|
||||||
|
|
||||||
|
FROM --platform=$BUILDPLATFORM base AS final
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG BUILDPLATFORM
|
||||||
|
|
||||||
|
RUN adduser --disabled-password \
|
||||||
|
--home /app \
|
||||||
|
--gecos '' dotnetuser && chown -R dotnetuser /app
|
||||||
|
|
||||||
|
USER dotnetuser
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build /app .
|
|
||||||
ENTRYPOINT ["dotnet", "MauMau-Server.dll"]
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["./MauMau-Server"]
|
||||||
Reference in New Issue
Block a user