-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
78 lines (62 loc) · 2.41 KB
/
Dockerfile
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
# base
#FROM registry:1337/external/dotnet-runtime AS base # can't use internal image cache with github
FROM mcr.microsoft.com/dotnet/runtime:8.0-bookworm-slim AS base
WORKDIR /app
# build
#FROM registry:1337/external/dotnet-sdk AS build # can't use internal image cache with github
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
WORKDIR /src
# su-exec
ADD su-exec.c /usr/local/src/
RUN set -eux && \
export TERM=dumb DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y --no-install-recommends gcc libc-dev && \
cd /usr/local/src && \
gcc -Wall su-exec.c -o su-exec && \
chown root:root su-exec && \
chmod 0755 su-exec
# build
COPY ["dotnet/Application/Application.csproj", "Application/"]
RUN dotnet restore "Application/Application.csproj"
COPY dotnet/ .
WORKDIR "/src/Application"
RUN dotnet build "Application.csproj" -c Release -o /app/build
# publish
FROM build AS publish
RUN dotnet publish "Application.csproj" -c Release -o /app/publish --self-contained -r linux-x64
# build test
FROM base AS test
WORKDIR /app
COPY --from=publish /app/publish .
RUN ./Application buildtest
# runtime image
FROM base AS release
WORKDIR /app
COPY --from=publish /app/publish .
# things we're gonna need, and things we want
RUN set -eux && \
export TERM=dumb DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y --no-install-recommends curl jq procps net-tools
# su-exec
COPY --from=build /usr/local/src/su-exec /usr/local/sbin/
# scripts
ADD scripts/* /usr/local/bin/
# ports
EXPOSE 5000
# health
HEALTHCHECK --start-period=60s --retries=1 --interval=10s --timeout=300s \
CMD [ "/usr/local/bin/healthcheck" ]
# default env
ENV \
GROHE_USER="" \
GROHE_PASS="" \
API_USER="" \
API_PASS="" \
LOCAL_PORT=""
# run!
USER root
ENTRYPOINT ["/bin/bash","-c"]
CMD ["exec /usr/local/bin/launch"]
# vim: tabstop=4:softtabstop=4:shiftwidth=4:expandtab