chore(deps): update asf-ui digest to d857ce5
[ArchiSteamFarm.git] / Dockerfile
blobc7742627437480a230f3f96a2e2264018cc054a7
1 ARG IMAGESUFFIX
3 FROM --platform=$BUILDPLATFORM node:lts${IMAGESUFFIX} AS build-node
4 WORKDIR /app/ASF-ui
5 COPY ASF-ui .
6 COPY .git/modules/ASF-ui /app/.git/modules/ASF-ui
8 RUN <<EOF
9     set -eu
11     echo "node: $(node --version)"
12     echo "npm: $(npm --version)"
14     npm ci --no-progress
15     npm run deploy --no-progress
16 EOF
18 FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0${IMAGESUFFIX} AS build-dotnet
19 ARG CONFIGURATION=Release
20 ARG TARGETARCH
21 ARG TARGETOS
22 ENV DOTNET_CLI_TELEMETRY_OPTOUT true
23 ENV DOTNET_NOLOGO true
24 ENV PLUGINS_BUNDLED ArchiSteamFarm.OfficialPlugins.ItemsMatcher ArchiSteamFarm.OfficialPlugins.MobileAuthenticator ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
25 WORKDIR /app
26 COPY --from=build-node /app/ASF-ui/dist ASF-ui/dist
27 COPY ArchiSteamFarm ArchiSteamFarm
28 COPY ArchiSteamFarm.OfficialPlugins.ItemsMatcher ArchiSteamFarm.OfficialPlugins.ItemsMatcher
29 COPY ArchiSteamFarm.OfficialPlugins.MobileAuthenticator ArchiSteamFarm.OfficialPlugins.MobileAuthenticator
30 COPY ArchiSteamFarm.OfficialPlugins.SteamTokenDumper ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
31 COPY resources resources
32 COPY .editorconfig .editorconfig
33 COPY Directory.Build.props Directory.Build.props
34 COPY Directory.Packages.props Directory.Packages.props
35 COPY LICENSE.txt LICENSE.txt
37 RUN --mount=type=secret,id=STEAM_TOKEN_DUMPER_TOKEN <<EOF
38     set -eu
40     dotnet --info
42     case "$TARGETOS" in
43         "linux") ;;
44         *) echo "ERROR: Unsupported OS: ${TARGETOS}"; exit 1 ;;
45     esac
47     case "$TARGETARCH" in
48         "amd64") asf_variant="${TARGETOS}-x64" ;;
49         "arm") asf_variant="${TARGETOS}-${TARGETARCH}" ;;
50         "arm64") asf_variant="${TARGETOS}-${TARGETARCH}" ;;
51         *) echo "ERROR: Unsupported CPU architecture: ${TARGETARCH}"; exit 1 ;;
52     esac
54     dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -o "out" -p:ASFVariant=docker -p:ContinuousIntegrationBuild=true -p:UseAppHost=false -r "$asf_variant" --nologo --no-self-contained
56     if [ -f "/run/secrets/STEAM_TOKEN_DUMPER_TOKEN" ]; then
57         STEAM_TOKEN_DUMPER_TOKEN="$(cat "/run/secrets/STEAM_TOKEN_DUMPER_TOKEN")"
59         if [ -n "$STEAM_TOKEN_DUMPER_TOKEN" ] && [ -f "ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SharedInfo.cs" ]; then
60             sed -i "s/STEAM_TOKEN_DUMPER_TOKEN/${STEAM_TOKEN_DUMPER_TOKEN}/g" "ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SharedInfo.cs"
61         else
62             echo "WARN: STEAM_TOKEN_DUMPER_TOKEN not applied!"
63         fi
64     else
65         echo "WARN: No STEAM_TOKEN_DUMPER_TOKEN provided!"
66     fi
68     for plugin in $PLUGINS_BUNDLED; do
69         dotnet publish "$plugin" -c "$CONFIGURATION" -o "out/plugins/$plugin" -p:ASFVariant=docker -p:ContinuousIntegrationBuild=true -p:UseAppHost=false -r "$asf_variant" --nologo
70     done
71 EOF
73 FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0${IMAGESUFFIX} AS runtime
74 ENV ASF_PATH /app
75 ENV ASF_USER asf
76 ENV ASPNETCORE_URLS=
77 ENV DOTNET_CLI_TELEMETRY_OPTOUT true
78 ENV DOTNET_NOLOGO true
80 LABEL maintainer="JustArchi <JustArchi@JustArchi.net>" \
81     org.opencontainers.image.authors="JustArchi <JustArchi@JustArchi.net>" \
82     org.opencontainers.image.url="https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Docker" \
83     org.opencontainers.image.documentation="https://github.com/JustArchiNET/ArchiSteamFarm/wiki" \
84     org.opencontainers.image.source="https://github.com/JustArchiNET/ArchiSteamFarm" \
85     org.opencontainers.image.vendor="JustArchiNET" \
86     org.opencontainers.image.licenses="Apache-2.0" \
87     org.opencontainers.image.title="ArchiSteamFarm" \
88     org.opencontainers.image.description="C# application with primary purpose of idling Steam cards from multiple accounts simultaneously"
90 EXPOSE 1242
91 COPY --from=build-dotnet /app/out /asf
93 RUN <<EOF
94     set -eu
96     mkdir -p "$ASF_PATH"
98     groupadd -r -g 1000 "$ASF_USER"
99     useradd -r -d "$ASF_PATH" -g 1000 -u 1000 "$ASF_USER"
100     chown -hR "${ASF_USER}:${ASF_USER}" "$ASF_PATH" /asf
102     ln -s /asf/ArchiSteamFarm.sh /usr/bin/ArchiSteamFarm
105 WORKDIR /app
106 VOLUME ["/app/config", "/app/logs"]
107 HEALTHCHECK CMD ["pidof", "-q", "dotnet"]
108 ENTRYPOINT ["ArchiSteamFarm", "--no-restart", "--system-required"]