-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Dockerfile.Service
114 lines (92 loc) · 4.35 KB
/
Dockerfile.Service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
ARG IMAGESUFFIX
FROM --platform=$BUILDPLATFORM node:lts${IMAGESUFFIX} AS build-node
WORKDIR /app/ASF-ui
COPY ASF-ui .
COPY .git/modules/ASF-ui /app/.git/modules/ASF-ui
RUN <<EOF
set -eu
echo "node: $(node --version)"
echo "npm: $(npm --version)"
npm ci --no-progress
npm run deploy --no-progress
EOF
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0${IMAGESUFFIX} AS build-dotnet
ARG CONFIGURATION=Release
ARG TARGETARCH
ARG TARGETOS
ENV DOTNET_CLI_TELEMETRY_OPTOUT=true
ENV DOTNET_NOLOGO=true
ENV PLUGINS_BUNDLED="ArchiSteamFarm.OfficialPlugins.ItemsMatcher ArchiSteamFarm.OfficialPlugins.MobileAuthenticator ArchiSteamFarm.OfficialPlugins.SteamTokenDumper"
WORKDIR /app
COPY --from=build-node /app/ASF-ui/dist ASF-ui/dist
COPY ArchiSteamFarm ArchiSteamFarm
COPY ArchiSteamFarm.OfficialPlugins.ItemsMatcher ArchiSteamFarm.OfficialPlugins.ItemsMatcher
COPY ArchiSteamFarm.OfficialPlugins.MobileAuthenticator ArchiSteamFarm.OfficialPlugins.MobileAuthenticator
COPY ArchiSteamFarm.OfficialPlugins.SteamTokenDumper ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
COPY resources resources
COPY .editorconfig .editorconfig
COPY Directory.Build.props Directory.Build.props
COPY Directory.Packages.props Directory.Packages.props
COPY LICENSE.txt LICENSE.txt
RUN --mount=type=secret,id=ASF_PRIVATE_SNK --mount=type=secret,id=STEAM_TOKEN_DUMPER_TOKEN <<EOF
set -eu
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
if [ -f "/run/secrets/ASF_PRIVATE_SNK" ]; then
base64 -d "/run/secrets/ASF_PRIVATE_SNK" > "resources/ArchiSteamFarm.snk"
else
echo "WARN: No ASF_PRIVATE_SNK provided!"
fi
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -o "out" "-p:ASFVariant=${asf_variant}" -p:ContinuousIntegrationBuild=true -p:PublishSingleFile=true -p:PublishTrimmed=true -r "$asf_variant" --nologo --self-contained
if [ -f "/run/secrets/STEAM_TOKEN_DUMPER_TOKEN" ]; then
STEAM_TOKEN_DUMPER_TOKEN="$(cat "/run/secrets/STEAM_TOKEN_DUMPER_TOKEN")"
if [ -n "STEAM_TOKEN_DUMPER_TOKEN" ] && [ -f "ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SharedInfo.cs" ]; then
sed -i "s/STEAM_TOKEN_DUMPER_TOKEN/${STEAM_TOKEN_DUMPER_TOKEN}/g" "ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SharedInfo.cs"
else
echo "WARN: STEAM_TOKEN_DUMPER_TOKEN not applied!"
fi
else
echo "WARN: No STEAM_TOKEN_DUMPER_TOKEN provided!"
fi
for plugin in $PLUGINS_BUNDLED; do
dotnet publish "$plugin" -c "$CONFIGURATION" -o "out/plugins/$plugin" "-p:ASFVariant=${asf_variant}" -p:ContinuousIntegrationBuild=true -p:UseAppHost=false -r "$asf_variant" --nologo
done
EOF
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0${IMAGESUFFIX} AS runtime
ENV ASF_PATH=/app
ENV ASF_USER=asf
ENV ASPNETCORE_URLS=
ENV DOTNET_CLI_TELEMETRY_OPTOUT=true
ENV DOTNET_NOLOGO=true
LABEL maintainer="JustArchi <[email protected]>" \
org.opencontainers.image.authors="JustArchi <[email protected]>" \
org.opencontainers.image.url="https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Docker" \
org.opencontainers.image.documentation="https://github.com/JustArchiNET/ArchiSteamFarm/wiki" \
org.opencontainers.image.source="https://github.com/JustArchiNET/ArchiSteamFarm" \
org.opencontainers.image.vendor="JustArchiNET" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.title="ArchiSteamFarm" \
org.opencontainers.image.description="C# application with primary purpose of idling Steam cards from multiple accounts simultaneously"
EXPOSE 1242
COPY --from=build-dotnet /app/out /asf
RUN <<EOF
set -eu
mkdir -p "$ASF_PATH"
groupadd -r -g 1000 "$ASF_USER"
useradd -r -d "$ASF_PATH" -g 1000 -u 1000 "$ASF_USER"
chown -hR "${ASF_USER}:${ASF_USER}" "$ASF_PATH" /asf
ln -s /asf/ArchiSteamFarm-Service.sh /usr/bin/ArchiSteamFarm
EOF
WORKDIR /app
VOLUME ["/app/config", "/app/logs"]
HEALTHCHECK CMD ["pidof", "-q", "ArchiSteamFarm"]
ENTRYPOINT ["ArchiSteamFarm", "--no-restart", "--system-required"]