Finish up docker docs and fix docker non-buildx builds

This commit is contained in:
Joseph Goh 2022-10-23 07:02:49 +08:00
parent 108b19970b
commit 298f277bf0
No known key found for this signature in database
GPG key ID: 0C83392A0999DD5A
2 changed files with 55 additions and 18 deletions

View file

@ -1,3 +1,6 @@
ARG TARGETPLATFORM=linux/amd64
ARG BUILDPLATFORM=${TARGETPLATFORM}
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder
ARG TARGETPLATFORM
@ -9,17 +12,18 @@ COPY . ./
# Build and package release based on target architecture
RUN dotnet build -v m
WORKDIR /TShock/TShockLauncher
RUN case "${TARGETPLATFORM}" in \
"linux/amd64") export ARCH="linux-x64" \
;; \
"linux/arm64") export ARCH="linux-arm64" \
;; \
"linux/arm/v7") export ARCH="linux-arm" \
;; \
"windows/amd64") export ARCH="win-x64" \
;; \
*) echo "Error: Unsupported platform ${TARGETPLATFORM}" && exit 1 \
;; \
RUN \
case "${TARGETPLATFORM}" in \
"linux/amd64") export ARCH="linux-x64" \
;; \
"linux/arm64") export ARCH="linux-arm64" \
;; \
"linux/arm/v7") export ARCH="linux-arm" \
;; \
"windows/amd64") export ARCH="win-x64" \
;; \
*) echo "Error: Unsupported platform ${TARGETPLATFORM}" && exit 1 \
;; \
esac && \
dotnet publish -o output/ -r "${ARCH}" -v m -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false