CI updates related to Docker containers (#2112)

* Initial commit trying to get ghcr running

* Move to v2

* Add lowercasing

* Replace docker hub worker

* Update

* Attempt to solve .net limitations

* Correct platforms

* Update docker-publish-master.yml

* Add remaining docker tags

* Add automatic DockerHub repo description update
This commit is contained in:
Łukasz Domeradzki
2021-01-02 14:49:03 +01:00
committed by GitHub
parent 08ff0ac7e5
commit e5efb86bd2
6 changed files with 187 additions and 35 deletions

View File

@@ -1,6 +1,4 @@
ARG DOTNET_ARCH=
FROM node:lts AS build-node
FROM --platform=$BUILDPLATFORM node:lts AS build-node
WORKDIR /app
COPY ASF-ui .
RUN echo "node: $(node --version)" && \
@@ -8,9 +6,10 @@ RUN echo "node: $(node --version)" && \
npm ci && \
npm run deploy
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-dotnet
ARG ASF_ARCH=x64
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:5.0 AS build-dotnet
ARG STEAM_TOKEN_DUMPER_TOKEN
ARG TARGETARCH
ARG TARGETOS
ENV CONFIGURATION Release
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
ENV DOTNET_NOLOGO 1
@@ -23,17 +22,27 @@ COPY ArchiSteamFarm.OfficialPlugins.SteamTokenDumper ArchiSteamFarm.OfficialPlug
COPY resources resources
COPY Directory.Build.props Directory.Build.props
RUN dotnet --info && \
case "$TARGETOS" in \
"linux") ;; \
*) echo "ERROR: Unsupported OS: ${TARGETOS}"; exit 1 ;; \
esac && \
case "$TARGETARCH" in \
"amd64") asf_variant="${TARGETOS}-x64" ;; \
"arm") asf_variant="${TARGETOS}-${TARGETARCH}" ;; \
"arm64") asf_variant="${TARGETOS}-${TARGETARCH}" ;; \
*) echo "ERROR: Unsupported CPU architecture: ${TARGETARCH}"; exit 1 ;; \
esac && \
# TODO: Remove workaround for https://github.com/microsoft/msbuild/issues/3897 when it's no longer needed
if [ -f "ArchiSteamFarm/Localization/Strings.zh-CN.resx" ]; then ln -s "Strings.zh-CN.resx" "ArchiSteamFarm/Localization/Strings.zh-Hans.resx"; fi && \
if [ -f "ArchiSteamFarm/Localization/Strings.zh-TW.resx" ]; then ln -s "Strings.zh-TW.resx" "ArchiSteamFarm/Localization/Strings.zh-Hant.resx"; fi && \
if [ -n "${STEAM_TOKEN_DUMPER_TOKEN-}" ] && [ -f "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs" ]; then sed -i "s/STEAM_TOKEN_DUMPER_TOKEN/${STEAM_TOKEN_DUMPER_TOKEN}/g" "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs"; fi && \
dotnet publish "${STEAM_TOKEN_DUMPER_NAME}" -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}" -p:SelfContained=false -p:UseAppHost=false -r "linux-${ASF_ARCH}" --nologo && \
dotnet clean ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -p:SelfContained=false -p:UseAppHost=false -r "linux-${ASF_ARCH}" --nologo && \
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/result" "-p:ASFVariant=linux-${ASF_ARCH}" -p:PublishSingleFile=true -p:PublishTrimmed=true -r "linux-${ASF_ARCH}" --nologo && \
if [ -d "ArchiSteamFarm/overlay/linux-${ASF_ARCH}" ]; then cp "ArchiSteamFarm/overlay/linux-${ASF_ARCH}/"* "out/result"; fi && \
if [ -f "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/${STEAM_TOKEN_DUMPER_NAME}.dll" ]; then mkdir -p "out/result/plugins/${STEAM_TOKEN_DUMPER_NAME}"; cp "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/${STEAM_TOKEN_DUMPER_NAME}.dll" "out/result/plugins/${STEAM_TOKEN_DUMPER_NAME}"; fi
dotnet publish "${STEAM_TOKEN_DUMPER_NAME}" -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}" -p:SelfContained=false -p:UseAppHost=false -r "$asf_variant" --nologo && \
dotnet clean ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -p:SelfContained=false -p:UseAppHost=false -r "$asf_variant" --nologo && \
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/result" "-p:ASFVariant=${asf_variant}" -p:PublishSingleFile=true -p:PublishTrimmed=true -r "$asf_variant" --nologo && \
if [ -d "ArchiSteamFarm/overlay/${asf_variant}" ]; then cp "ArchiSteamFarm/overlay/${asf_variant}/"* "out/result"; fi && \
if [ -d "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}" ]; then mkdir -p "out/result/plugins/${STEAM_TOKEN_DUMPER_NAME}"; cp -pR "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/"* "out/result/plugins/${STEAM_TOKEN_DUMPER_NAME}"; fi
FROM mcr.microsoft.com/dotnet/runtime-deps:5.0-buster-slim${DOTNET_ARCH} AS runtime
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime-deps:5.0 AS runtime
ENV ASPNETCORE_URLS=
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
ENV DOTNET_NOLOGO 1