Fix occassional failures by not publishing plugins in parallel
[ArchiSteamFarm.git] / Dockerfile
blob801237812d12f23d68c5a073ce982926e896e081
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
7 RUN set -eu; \
8     echo "node: $(node --version)"; \
9     echo "npm: $(npm --version)"; \
10     npm ci --no-progress; \
11     npm run deploy --no-progress
13 FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0${IMAGESUFFIX} AS build-dotnet
14 ARG CONFIGURATION=Release
15 ARG STEAM_TOKEN_DUMPER_TOKEN
16 ARG TARGETARCH
17 ARG TARGETOS
18 ENV DOTNET_CLI_TELEMETRY_OPTOUT true
19 ENV DOTNET_NOLOGO true
20 ENV PLUGINS_BUNDLED ArchiSteamFarm.OfficialPlugins.ItemsMatcher ArchiSteamFarm.OfficialPlugins.MobileAuthenticator ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
21 WORKDIR /app
22 COPY --from=build-node /app/ASF-ui/dist ASF-ui/dist
23 COPY ArchiSteamFarm ArchiSteamFarm
24 COPY ArchiSteamFarm.OfficialPlugins.ItemsMatcher ArchiSteamFarm.OfficialPlugins.ItemsMatcher
25 COPY ArchiSteamFarm.OfficialPlugins.MobileAuthenticator ArchiSteamFarm.OfficialPlugins.MobileAuthenticator
26 COPY ArchiSteamFarm.OfficialPlugins.SteamTokenDumper ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
27 COPY resources resources
28 COPY .editorconfig .editorconfig
29 COPY Directory.Build.props Directory.Build.props
30 COPY Directory.Packages.props Directory.Packages.props
31 COPY LICENSE.txt LICENSE.txt
32 RUN set -eu; \
33     dotnet --info; \
34     \
35     case "$TARGETOS" in \
36       "linux") ;; \
37       *) echo "ERROR: Unsupported OS: ${TARGETOS}"; exit 1 ;; \
38     esac; \
39     \
40     case "$TARGETARCH" in \
41       "amd64") asf_variant="${TARGETOS}-x64" ;; \
42       "arm") asf_variant="${TARGETOS}-${TARGETARCH}" ;; \
43       "arm64") asf_variant="${TARGETOS}-${TARGETARCH}" ;; \
44       *) echo "ERROR: Unsupported CPU architecture: ${TARGETARCH}"; exit 1 ;; \
45     esac; \
46     \
47     dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -o "out" -p:ASFVariant=docker -p:ContinuousIntegrationBuild=true -p:UseAppHost=false -r "$asf_variant" --nologo --no-self-contained; \
48     \
49     if [ -n "${STEAM_TOKEN_DUMPER_TOKEN-}" ] && [ -f "ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SharedInfo.cs" ]; then \
50       sed -i "s/STEAM_TOKEN_DUMPER_TOKEN/${STEAM_TOKEN_DUMPER_TOKEN}/g" "ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SharedInfo.cs"; \
51     fi; \
52     \
53     for plugin in $PLUGINS_BUNDLED; do \
54       dotnet publish "$plugin" -c "$CONFIGURATION" -o "out/plugins/$plugin" -p:ASFVariant=docker -p:ContinuousIntegrationBuild=true -p:UseAppHost=false -r "$asf_variant" --nologo; \
55     done
57 FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0${IMAGESUFFIX} AS runtime
58 ENV ASF_PATH /app
59 ENV ASF_USER asf
60 ENV ASPNETCORE_URLS=
61 ENV DOTNET_CLI_TELEMETRY_OPTOUT true
62 ENV DOTNET_NOLOGO true
64 LABEL maintainer="JustArchi <JustArchi@JustArchi.net>" \
65     org.opencontainers.image.authors="JustArchi <JustArchi@JustArchi.net>" \
66     org.opencontainers.image.url="https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Docker" \
67     org.opencontainers.image.documentation="https://github.com/JustArchiNET/ArchiSteamFarm/wiki" \
68     org.opencontainers.image.source="https://github.com/JustArchiNET/ArchiSteamFarm" \
69     org.opencontainers.image.vendor="JustArchiNET" \
70     org.opencontainers.image.licenses="Apache-2.0" \
71     org.opencontainers.image.title="ArchiSteamFarm" \
72     org.opencontainers.image.description="C# application with primary purpose of idling Steam cards from multiple accounts simultaneously"
74 EXPOSE 1242
75 WORKDIR /app
76 COPY --from=build-dotnet /app/out /asf
78 RUN set -eu; \
79     groupadd -r -g 1000 asf; \
80     useradd -r -d /app -g 1000 -u 1000 asf; \
81     mkdir -p /app /asf; \
82     chown -hR asf:asf /app /asf; \
83     ln -s /asf/ArchiSteamFarm.sh /usr/bin/ArchiSteamFarm
85 VOLUME ["/app/config", "/app/logs"]
86 HEALTHCHECK CMD ["pidof", "-q", "dotnet"]
87 ENTRYPOINT ["ArchiSteamFarm", "--no-restart", "--process-required", "--system-required"]