-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (25 loc) · 902 Bytes
/
Dockerfile
File metadata and controls
34 lines (25 loc) · 902 Bytes
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
# syntax=docker/dockerfile:1.7
# ---------- build stage ----------
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
WORKDIR /src
# Restore first for better layer caching
COPY src/AgentStarter.csproj ./src/
RUN dotnet restore ./src/AgentStarter.csproj
# Copy the rest and publish trimmed runtime-only output
COPY src/ ./src/
RUN dotnet publish ./src/AgentStarter.csproj \
-c Release \
-o /app/publish \
--no-restore \
/p:UseAppHost=false
# ---------- runtime stage ----------
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS runtime
# Non-root user — Docker best practice
RUN addgroup -S agent && adduser -S agent -G agent
WORKDIR /app
COPY --from=build --chown=agent:agent /app/publish .
USER agent
# Env defaults (override at runtime with -e or compose)
ENV DOTNET_EnableDiagnostics=0 \
DOTNET_RUNNING_IN_CONTAINER=true
ENTRYPOINT ["dotnet", "AgentStarter.dll"]