-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (30 loc) · 1.16 KB
/
Dockerfile
File metadata and controls
41 lines (30 loc) · 1.16 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
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
# Copy solution and project files first for better layer caching
COPY Source/Beacon.sln Source/
COPY Source/Beacon/Beacon.csproj Source/Beacon/
COPY Source/Beacon.Core/Beacon.Core.csproj Source/Beacon.Core/
COPY Source/Beacon.Storage/Beacon.Storage.csproj Source/Beacon.Storage/
COPY Source/Beacon.Tokens/Beacon.Tokens.csproj Source/Beacon.Tokens/
COPY Source/Beacon.Tests/Beacon.Tests.csproj Source/Beacon.Tests/
# Restore dependencies
RUN dotnet restore Source/Beacon.sln
# Copy remaining source code
COPY Source/ Source/
# Build and publish
RUN dotnet publish Source/Beacon/Beacon.csproj -c Release -o /app/publish --no-restore
# Runtime image
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app
# Create non-root user for security
RUN groupadd -r beacon && useradd -r -g beacon beacon
# Copy published output
COPY --from=build /app/publish .
# Create directories for data persistence
RUN mkdir -p /app/data /app/.core
# Set ownership and switch to non-root user
RUN chown -R beacon:beacon /app
USER beacon
# Expose ports for port-based routing
EXPOSE 5000 5001
ENTRYPOINT ["dotnet", "Beacon.dll"]