diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 28e3903..18b14d0 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -18,7 +18,7 @@ jobs: - name: build server run: | - docker build --build-arg BASE_URL=https://mistox.com -t mistox-website . + docker buildx build --platform=linux/amd64,linux/arm64 --build-arg BASE_URL=https://mistox.com -t mistox-website . - name: publish database run: | diff --git a/Dockerfile b/Dockerfile index 449d323..fb9d76b 100755 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN ng build --base-href=${BASE_URL} ## Build Backend ## ##################### -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build-backend +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build-backend WORKDIR /src # Copy the csproj @@ -39,8 +39,19 @@ RUN dotnet restore './MistoxWebsite.Server.csproj' # Copy the rest of the backend over COPY ./src/MistoxWebsite.Server/ ./ +# Get the target arch +ARG TARGETOS TARGETARCH + # Build the source -RUN dotnet publish './MistoxWebsite.Server.csproj' -c Release -o /app/publish +RUN if [ $TARGETARCH = "arm64" ]; then \ + RID="arm64" \ + elif [ "$TARGETARCHARCH" = "amd64" ]; then \ + RID="x64" \ + else \ + echo "Unsupported ARCH: $ARCH" \ + exit 1 \ + fi \ + dotnet publish './MistoxWebsite.Server.csproj' -c Release -r $TARGETOS-$RID -o /app/publish ################ ## Publish ##