Remove CodeStyle for VS (#2708)
[ArchiSteamFarm.git] / Dockerfile.Service
blob2393e8d1d13de69e3c47efa49939024195cec6fb
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 echo "node: $(node --version)" && \
8     echo "npm: $(npm --version)" && \
9     npm ci --no-progress && \
10     npm run deploy --no-progress
12 FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0${IMAGESUFFIX} AS build-dotnet
13 ARG CONFIGURATION=Release
14 ARG STEAM_TOKEN_DUMPER_TOKEN
15 ARG TARGETARCH
16 ARG TARGETOS
17 ENV DOTNET_CLI_TELEMETRY_OPTOUT true
18 ENV DOTNET_NOLOGO true
19 ENV NET_CORE_VERSION net6.0
20 ENV STEAM_TOKEN_DUMPER_NAME 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.SteamTokenDumper ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
25 COPY resources resources
26 COPY .editorconfig .editorconfig
27 COPY Directory.Build.props Directory.Build.props
28 COPY Directory.Packages.props Directory.Packages.props
29 COPY LICENSE.txt LICENSE.txt
30 RUN dotnet --info && \
31     case "$TARGETOS" in \
32       "linux") ;; \
33       *) echo "ERROR: Unsupported OS: ${TARGETOS}"; exit 1 ;; \
34     esac && \
35     case "$TARGETARCH" in \
36       "amd64") asf_variant="${TARGETOS}-x64" ;; \
37       "arm") asf_variant="${TARGETOS}-${TARGETARCH}" ;; \
38       "arm64") asf_variant="${TARGETOS}-${TARGETARCH}" ;; \
39       *) echo "ERROR: Unsupported CPU architecture: ${TARGETARCH}"; exit 1 ;; \
40     esac && \
41     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"; dotnet publish "${STEAM_TOKEN_DUMPER_NAME}" -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}" "-p:ASFVariant=${asf_variant}" -p:ContinuousIntegrationBuild=true -p:UseAppHost=false -r "$asf_variant" --nologo --no-self-contained; fi && \
42     dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/result" "-p:ASFVariant=${asf_variant}" -p:ContinuousIntegrationBuild=true -p:PublishSingleFile=true -p:PublishTrimmed=true -r "$asf_variant" --nologo --self-contained && \
43     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
45 FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime-deps:6.0${IMAGESUFFIX} AS runtime
46 ENV ASF_USER asf
47 ENV ASPNETCORE_URLS=
48 ENV DOTNET_CLI_TELEMETRY_OPTOUT true
49 ENV DOTNET_NOLOGO true
51 LABEL maintainer="JustArchi <JustArchi@JustArchi.net>" \
52     org.opencontainers.image.authors="JustArchi <JustArchi@JustArchi.net>" \
53     org.opencontainers.image.url="https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Docker" \
54     org.opencontainers.image.documentation="https://github.com/JustArchiNET/ArchiSteamFarm/wiki" \
55     org.opencontainers.image.source="https://github.com/JustArchiNET/ArchiSteamFarm" \
56     org.opencontainers.image.vendor="JustArchiNET" \
57     org.opencontainers.image.licenses="Apache-2.0" \
58     org.opencontainers.image.title="ArchiSteamFarm" \
59     org.opencontainers.image.description="C# application with primary purpose of idling Steam cards from multiple accounts simultaneously"
61 EXPOSE 1242
62 WORKDIR /app
63 COPY --from=build-dotnet /app/out/result .
65 RUN groupadd -r -g 1000 asf && \
66     useradd -r -d /app -g 1000 -u 1000 asf && \
67     chown -hR asf:asf /app
69 VOLUME ["/app/config", "/app/logs"]
70 HEALTHCHECK CMD ["pidof", "-q", "ArchiSteamFarm"]
71 ENTRYPOINT ["sh", "ArchiSteamFarm-Service.sh", "--no-restart", "--process-required", "--system-required"]