Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
85 lines (73 loc) · 4.17 KB
/
Copy pathDockerfile
File metadata and controls
85 lines (73 loc) · 4.17 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
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
79
80
81
82
83
84
85
FROM mcr.microsoft.com/dotnet/sdk:10.0-noble@sha256:e1ffd2a92ae84c1291bc1b6887501f8af98e6331e7af6d4c8d37168c5e87a64c AS build
WORKDIR /src
RUN dotnet tool install --global Microsoft.Web.LibraryManager.Cli
ENV PATH="$PATH:/root/.dotnet/tools"
COPY Directory.Build.props Directory.Packages.props global.json ./
COPY src/Server/Web/K7.Server.Web.csproj src/Server/Web/
COPY src/Server/Application/K7.Server.Application.csproj src/Server/Application/
COPY src/Server/Domain/K7.Server.Domain.csproj src/Server/Domain/
COPY src/Server/Infrastructure/Database/Context/*.csproj src/Server/Infrastructure/Database/Context/
COPY src/Server/Infrastructure/Database/Providers/Postgres/*.csproj src/Server/Infrastructure/Database/Providers/Postgres/
COPY src/Server/Infrastructure/Database/Providers/Sqlite/*.csproj src/Server/Infrastructure/Database/Providers/Sqlite/
COPY src/Server/Infrastructure/Configuration/*.csproj src/Server/Infrastructure/Configuration/
COPY src/Server/Infrastructure/ExternalServices/*.csproj src/Server/Infrastructure/ExternalServices/
COPY src/Server/Infrastructure/FileSystem/*.csproj src/Server/Infrastructure/FileSystem/
COPY src/Server/Infrastructure/MediaProcessing/*.csproj src/Server/Infrastructure/MediaProcessing/
COPY src/Shared/Aspire/ServiceDefaults/*.csproj src/Shared/Aspire/ServiceDefaults/
COPY src/Shared/K7.Shared/*.csproj src/Shared/K7.Shared/
COPY src/Clients/Shared/K7.Clients.Shared.csproj src/Clients/Shared/
COPY src/Clients/Shared/UI/K7.Clients.Shared.UI.csproj src/Clients/Shared/UI/
COPY src/Clients/Web/*.csproj src/Clients/Web/
RUN dotnet restore "src/Server/Web/K7.Server.Web.csproj"
COPY src/Clients/Shared/UI/libman.json src/Clients/Shared/UI/
COPY src/Clients/Web/libman.json src/Clients/Web/
RUN set -e; \
for manifest in $(find . -name "libman.json"); do \
(cd "$(dirname "$manifest")" && libman restore); \
done
COPY . .
ARG BUILD_CONFIGURATION=Release
ARG APP_VERSION=0.0.0
RUN dotnet publish "src/Server/Web/K7.Server.Web.csproj" \
-c $BUILD_CONFIGURATION -o /publish --no-restore \
-p:Version=${APP_VERSION}
# VS Fast Mode debug stage (F5 in Visual Studio with Docker profile)
FROM build AS dev
# va-driver-all pulls arch-appropriate VAAPI drivers (Intel packages are amd64/i386 only).
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ffmpeg \
vainfo \
va-driver-all \
&& (apt-get install -y --no-install-recommends intel-media-va-driver-non-free || true) \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 7080 7443
FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble@sha256:a4556ed033fa96f984bb7a8d348851cb2d36b1281dd2420070045f664fbb5f94 AS runtime
# va-driver-all pulls arch-appropriate VAAPI drivers (Intel packages are amd64/i386 only).
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gosu \
ffmpeg \
curl \
vainfo \
va-driver-all \
&& (apt-get install -y --no-install-recommends intel-media-va-driver-non-free || true) \
&& rm -rf /var/lib/apt/lists/*
FROM runtime AS final
RUN groupadd -g 911 appgroup && useradd -u 911 -g appgroup -m appuser
WORKDIR /k7
COPY --from=build /publish .
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENV ASPNETCORE_HTTP_PORTS=7080
# Return native heap (Skia/glibc) more eagerly.
ENV MALLOC_TRIM_THRESHOLD_=131072
# Quieter default logs in containers; keep K7 + host lifetime at Information for startup/setup.
ENV Serilog__MinimumLevel__Default=Warning
ENV Serilog__MinimumLevel__Override__K7=Information
ENV Serilog__MinimumLevel__Override__Microsoft.Hosting.Lifetime=Information
EXPOSE 7080
HEALTHCHECK --interval=30s --timeout=5s --start-period=40s --retries=3 \
CMD curl -fsS http://127.0.0.1:7080/health || exit 1
LABEL org.opencontainers.image.source="https://github.com/kaybi-gh/K7"
ENTRYPOINT ["/entrypoint.sh"]