47 lines
1.4 KiB
Docker
47 lines
1.4 KiB
Docker
FROM mcr.microsoft.com/dotnet/sdk:10.0.101 AS build
|
|
WORKDIR /src
|
|
|
|
# wasm-tools provides Microsoft.AspNetCore.App.Internal.Assets, which contains
|
|
# blazor.web.js, blazor.server.js, and the other Blazor framework JS files.
|
|
# Without this workload the publish output silently omits those files.
|
|
RUN dotnet workload install wasm-tools
|
|
|
|
COPY Directory.Build.props ./
|
|
COPY src/EntKube.Web/EntKube.Web.csproj src/EntKube.Web/
|
|
COPY src/EntKube.Web.Client/EntKube.Web.Client.csproj src/EntKube.Web.Client/
|
|
RUN dotnet restore src/EntKube.Web/EntKube.Web.csproj
|
|
|
|
COPY src/ src/
|
|
RUN dotnet publish src/EntKube.Web/EntKube.Web.csproj \
|
|
--no-restore \
|
|
-c Release \
|
|
-o /app/publish
|
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
|
|
WORKDIR /app
|
|
|
|
# libgit2sharp bundles its native lib, but needs libssl/libcurl on Debian
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libssl3 \
|
|
libcurl4 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Run as non-root
|
|
RUN groupadd --system appgroup && useradd --system --gid appgroup --no-create-home appuser
|
|
RUN mkdir -p /app/Data && chown appuser:appgroup /app/Data
|
|
|
|
COPY --from=build /app/publish .
|
|
RUN chown -R appuser:appgroup /app
|
|
|
|
USER appuser
|
|
|
|
ENV ASPNETCORE_URLS=http://+:8080
|
|
ENV ASPNETCORE_ENVIRONMENT=Production
|
|
|
|
# SQLite database lives here — mount a persistent volume at /app/Data
|
|
VOLUME ["/app/Data"]
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["dotnet", "EntKube.Web.dll"]
|