-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 1.46 KB
/
Copy pathDockerfile
File metadata and controls
37 lines (27 loc) · 1.46 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
# ── Build stage ──────────────────────────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
# Copy solution + project files first (layer-cache friendly)
COPY ShopCore.sln global.json ./
COPY src/ShopCore.API/ShopCore.API.csproj src/ShopCore.API/
COPY src/ShopCore.Application/ShopCore.Application.csproj src/ShopCore.Application/
COPY src/ShopCore.Domain/ShopCore.Domain.csproj src/ShopCore.Domain/
COPY src/ShopCore.Infrastructure/ShopCore.Infrastructure.csproj src/ShopCore.Infrastructure/
# Restore dependencies
RUN dotnet restore src/ShopCore.API/ShopCore.API.csproj
# Copy everything else and build
COPY . .
RUN dotnet publish src/ShopCore.API/ShopCore.API.csproj \
-c Release \
-o /app/publish \
--no-restore
# ── Runtime stage ─────────────────────────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app
RUN groupadd --system appgroup && \
useradd --system --gid appgroup --no-create-home appuser
COPY --from=build /app/publish .
RUN mkdir -p logs && chown -R appuser:appgroup /app
USER appuser
EXPOSE 8080
ENTRYPOINT ["dotnet", "ShopCore.API.dll"]