From 8eb4ea2e70650175a5e3b7749e95e7c041ff277e Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Wed, 21 Feb 2024 18:34:32 +0200 Subject: [PATCH] Fix --- .github/workflows/backend-docker.yml | 1 - src/BUTR.Site.NexusMods.Server/Dockerfile | 27 +++++++++++------------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/backend-docker.yml b/.github/workflows/backend-docker.yml index 9e935605..b80c2a01 100644 --- a/.github/workflows/backend-docker.yml +++ b/.github/workflows/backend-docker.yml @@ -66,4 +66,3 @@ jobs: token: ${{ secrets.TOKEN_GPR }} repository: BUTR/BUTR.Site.NexusMods event-type: deploy-docker-image - diff --git a/src/BUTR.Site.NexusMods.Server/Dockerfile b/src/BUTR.Site.NexusMods.Server/Dockerfile index bcf89868..1a0c7f3d 100644 --- a/src/BUTR.Site.NexusMods.Server/Dockerfile +++ b/src/BUTR.Site.NexusMods.Server/Dockerfile @@ -1,23 +1,21 @@ -FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy AS base -WORKDIR /app - -FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS restore +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS restore +ARG TARGETARCH WORKDIR /build -COPY ["src/BUTR.Site.NexusMods.Server/BUTR.Site.NexusMods.Server.csproj", "src/BUTR.Site.NexusMods.Server/"] +COPY ["src/BUTR.Site.NexusMods.DependencyInjection/BUTR.Site.NexusMods.DependencyInjection.csproj", "src/BUTR.Site.NexusMods.DependencyInjection/"] COPY ["src/BUTR.Site.NexusMods.Shared/BUTR.Site.NexusMods.Shared.csproj", "src/BUTR.Site.NexusMods.Shared/"] +COPY ["src/BUTR.Site.NexusMods.Server/BUTR.Site.NexusMods.Server.csproj", "src/BUTR.Site.NexusMods.Server/"] COPY ["src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/BUTR.Site.NexusMods.Server.ValueObjects.Vogen.csproj", "src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/"] -COPY ["src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/BUTR.Site.NexusMods.Server.ValueObjects.TVO.csproj", "src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/"] -COPY ["src/BUTR.Site.NexusMods.DependencyInjection/BUTR.Site.NexusMods.DependencyInjection.csproj", "src/BUTR.Site.NexusMods.DependencyInjection/"] +#COPY ["src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/BUTR.Site.NexusMods.Server.ValueObjects.TVO.csproj", "src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/"] COPY ["src/nuget.config", "src/"] -RUN dotnet restore "src/BUTR.Site.NexusMods.Server/BUTR.Site.NexusMods.Server.csproj"; +RUN dotnet restore "src/BUTR.Site.NexusMods.Server/BUTR.Site.NexusMods.Server.csproj" -a $TARGETARCH; -COPY ["src/BUTR.Site.NexusMods.Server/", "src/BUTR.Site.NexusMods.Server/"] +COPY ["src/BUTR.Site.NexusMods.DependencyInjection/", "src/BUTR.Site.NexusMods.DependencyInjection/"] COPY ["src/BUTR.Site.NexusMods.Shared/", "src/BUTR.Site.NexusMods.Shared/"] +COPY ["src/BUTR.Site.NexusMods.Server/", "src/BUTR.Site.NexusMods.Server/"] COPY ["src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/", "src/BUTR.Site.NexusMods.Server.ValueObjects.Vogen/"] -COPY ["src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/", "src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/"] -COPY ["src/BUTR.Site.NexusMods.DependencyInjection/", "src/BUTR.Site.NexusMods.DependencyInjection/"] +#COPY ["src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/", "src/BUTR.Site.NexusMods.Server.ValueObjects.TVO/"] COPY [".git/HEAD", ".git/HEAD"] COPY [".git/config", ".git/config"] @@ -25,14 +23,15 @@ COPY [".git/refs/heads/", ".git/refs/heads/"] FROM restore AS publish +ARG TARGETARCH WORKDIR /build -RUN dotnet publish "src/BUTR.Site.NexusMods.Server/BUTR.Site.NexusMods.Server.csproj" -c Release -o /app/publish; +RUN dotnet publish "src/BUTR.Site.NexusMods.Server/BUTR.Site.NexusMods.Server.csproj" --no-restore -c Release -a $TARGETARCH -o /app/publish; #RUN dotnet publish "src/BUTR.Site.NexusMods.Server/BUTR.Site.NexusMods.Server.csproj" --no-restore -c Release -r linux-x64 -o /app/publish -p:PublishReadyToRun=true; -FROM base AS final - +FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy AS final +WORKDIR /app RUN apt-get update \ && apt-get install -y wget \ && wget https://packages.microsoft.com/config/ubuntu/22.10/packages-microsoft-prod.deb \