forked from gridlabs-science/boot-protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 1.66 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (34 loc) · 1.66 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
38
39
40
41
42
43
44
45
46
47
ARG GRIDPOOL_RELEASE_VERSION=dev
FROM node:24-bookworm-slim AS dashboard-build
WORKDIR /src/boot_portal/ui
COPY boot_portal/ui/package.json boot_portal/ui/package-lock.json ./
RUN npm ci
COPY boot_portal/ui/ ./
RUN npm run build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY boot_portal/boot_portal.csproj boot_portal/
RUN dotnet restore boot_portal/boot_portal.csproj
COPY . .
COPY --from=dashboard-build /src/boot_portal/wwwroot/dashboard boot_portal/wwwroot/dashboard
RUN dotnet publish boot_portal/boot_portal.csproj -c Release -o /app/publish /p:UseAppHost=false
FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble AS runtime
RUN apt-get update \
&& apt-get install -y --no-install-recommends libsodium23 ca-certificates curl \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /data /app \
&& chown -R 1000:1000 /data /app
ARG GRIDPOOL_RELEASE_VERSION
WORKDIR /app
ENV BOOT_PORTAL_CONFIG_PATH=/data/boot_portal_config.json
ENV BOOT_PORTAL_STATE_PATH=/data/pool_state.json
ENV GRIDPOOL_RELEASE_VERSION=${GRIDPOOL_RELEASE_VERSION}
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 1000:1000 /app
USER 1000:1000
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"]