-
-
Notifications
You must be signed in to change notification settings - Fork 327
/
Dockerfile.console
56 lines (44 loc) · 1.37 KB
/
Dockerfile.console
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
###################
# CREATE FINAL LAYER
###################
FROM mcr.microsoft.com/dotnet/aspnet:7.0 as final
RUN apt-get update \
&& apt-get -y install bash tzdata \
&& apt-get purge -y -f --force-yes $EXT_BUILD_DEPS \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd -g 1015 p2g && useradd -g p2g -u 1015 p2g
WORKDIR /app
RUN mkdir -m770 {output,data,working}
###################
# BUILD LAYER
###################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 AS build
COPY . /build
WORKDIR /build
###################
# BUILD CONSOLE APP
###################
ARG VERSION
ENV VERSION=$VERSION
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
RID=linux-x64 ; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
RID=linux-arm64 ; \
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
RID=linux-arm ; \
fi \
&& dotnet publish /build/src/ConsoleClient/ConsoleClient.csproj -c Release -r $RID -o /build/published --version-suffix $VERSION --self-contained ;
###################
# FINAL
###################
FROM final
COPY --from=build /build/published .
COPY --from=build /build/LICENSE ./LICENSE
COPY --from=build /build/configuration.example.json ./configuration.local.json
COPY --chmod=770 ./docker/entrypoint.sh .
EXPOSE 80 443
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["console"]