Misc docker fixes

This commit is contained in:
JustArchi 2020-06-14 01:36:04 +02:00
parent 017b26986b
commit 4a6480d223
3 changed files with 24 additions and 35 deletions

View file

@ -7,7 +7,7 @@ RUN echo "node: $(node --version)" && \
npm run deploy
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-dotnet
ARG BUILD_ARCH=x64
ARG ASF_ARCH=x64
ARG STEAM_TOKEN_DUMPER_TOKEN
ENV CONFIGURATION Release
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
@ -25,14 +25,14 @@ RUN dotnet --info && \
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-$BUILD_ARCH --nologo && \
dotnet clean ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -p:SelfContained=false -p:UseAppHost=false -r linux-$BUILD_ARCH --nologo && \
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/result" -p:ASFVariant=docker -p:SelfContained=false -p:UseAppHost=false -r linux-$BUILD_ARCH --nologo && \
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=docker -p:SelfContained=false -p:UseAppHost=false -r "linux-${ASF_ARCH}" --nologo && \
if [ -d "ArchiSteamFarm/overlay/generic" ]; then cp "ArchiSteamFarm/overlay/generic/"* "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
ARG TAG_ARCH=""
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim$TAG_ARCH AS runtime
ARG DOTNET_ARCH=
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim${DOTNET_ARCH} AS runtime
ENV ASPNETCORE_URLS=
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1

View file

@ -7,7 +7,7 @@ RUN echo "node: $(node --version)" && \
npm run deploy
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-dotnet
ARG BUILD_ARCH=x64
ARG ASF_ARCH=x64
ARG STEAM_TOKEN_DUMPER_TOKEN
ENV CONFIGURATION Release
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
@ -25,14 +25,14 @@ RUN dotnet --info && \
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-$BUILD_ARCH --nologo && \
dotnet clean ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -p:SelfContained=false -p:UseAppHost=false -r linux-$BUILD_ARCH --nologo && \
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/result" -p:ASFVariant=linux-$BUILD_ARCH -p:PublishSingleFile=true -p:PublishTrimmed=true -r linux-$BUILD_ARCH --nologo && \
if [ -d "ArchiSteamFarm/overlay/linux-$BUILD_ARCH" ]; then cp "ArchiSteamFarm/overlay/linux-$BUILD_ARCH/"* "out/result"; 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
ARG TAG_ARCH=""
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1-buster-slim$TAG_ARCH AS runtime
ARG DOTNET_ARCH=
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1-buster-slim${DOTNET_ARCH} AS runtime
ENV ASPNETCORE_URLS=
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1

View file

@ -1,24 +1,13 @@
#!/bin/bash
#!/usr/bin/env sh
set -eu
# no - in tag means we build amd64
if [[ $DOCKER_TAG =~ "-" ]]; then
case ${DOCKER_TAG#*-} in
arm)
BUILD_ARCH=arm
TAG_ARCH="-arm32v7"
;;
arm64)
BUILD_ARCH=arm64
TAG_ARCH="-arm64v8"
;;
esac
else
BUILD_ARCH=x64
# needs to be blank cause dotnet images have no suffix for amd64
TAG_ARCH=
fi
asf_arch="$(echo "$DOCKER_TAG" | cut -d '-' -f 2)"
dotnet_arch=""
docker build -f $DOCKERFILE_PATH -t $IMAGE_NAME . \
--build-arg STEAM_TOKEN_DUMPER_TOKEN=$STEAM_TOKEN_DUMPER_TOKEN \
--build-arg BUILD_ARCH=$BUILD_ARCH \
--build-arg TAG_ARCH=$TAG_ARCH
case "$asf_arch" in
"arm") dotnet_arch="-arm32v7" ;;
"arm64") dotnet_arch="-arm64v8" ;;
*) asf_arch="x64" ;;
esac
docker build -f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" --build-arg "STEAM_TOKEN_DUMPER_TOKEN=${STEAM_TOKEN_DUMPER_TOKEN-}" --build-arg "ASF_ARCH=${asf_arch}" --build-arg "DOTNET_ARCH=${dotnet_arch}" .