-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (26 loc) · 1.37 KB
/
Copy pathDockerfile
File metadata and controls
37 lines (26 loc) · 1.37 KB
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
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY boot_portal/boot_portal.csproj boot_portal/
RUN dotnet restore boot_portal/boot_portal.csproj
COPY . .
RUN dotnet publish boot_portal/boot_portal.csproj -c Release -o /app/publish /p:UseAppHost=false
FROM mcr.microsoft.com/dotnet/aspnet:9.0-bookworm-slim AS runtime
RUN apt-get update \
&& apt-get install -y --no-install-recommends libsodium23 ca-certificates curl \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --gid 1000 boot \
&& useradd --uid 1000 --gid boot --create-home --shell /usr/sbin/nologin boot \
&& mkdir -p /data /app \
&& chown -R boot:boot /data /app
WORKDIR /app
ENV BOOT_PORTAL_CONFIG_PATH=/data/boot_portal_config.json
ENV BOOT_PORTAL_STATE_PATH=/data/pool_state.json
VOLUME ["/data"]
EXPOSE 5000 3008
COPY --from=build /app/publish .
COPY docker/boot_portal_config.sample.json /app/defaults/boot_portal_config.sample.json
RUN chown -R boot:boot /app
USER boot
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD curl -fsS http://127.0.0.1:5000/health/live || exit 1
ENTRYPOINT ["/bin/sh", "-c", "mkdir -p \"$(dirname \"$BOOT_PORTAL_CONFIG_PATH\")\" \"$(dirname \"$BOOT_PORTAL_STATE_PATH\")\" && if [ ! -f \"$BOOT_PORTAL_CONFIG_PATH\" ]; then cp /app/defaults/boot_portal_config.sample.json \"$BOOT_PORTAL_CONFIG_PATH\"; fi; exec dotnet boot_portal.dll"]