Skip to content

Commit a82ff5b

Browse files
committed
Updated Dockerfile
1 parent c3478a5 commit a82ff5b

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

Dockerfile

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
1+
# syntax=docker/dockerfile:1
2+
3+
ARG DOTNET_VERSION=10.0
4+
5+
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS build
26
WORKDIR /src
37

4-
# Copy csproj and restore as distinct layers
5-
COPY ["OpenBioCardServer.csproj", "./"]
6-
RUN dotnet restore "OpenBioCardServer.csproj"
8+
COPY OpenBioCardServer/OpenBioCardServer.csproj OpenBioCardServer/
9+
RUN dotnet restore OpenBioCardServer/OpenBioCardServer.csproj
710

8-
# Copy everything else and build
911
COPY . .
10-
RUN dotnet publish "OpenBioCardServer.csproj" -c Release -o /app/publish /p:UseAppHost=false
12+
RUN dotnet publish OpenBioCardServer/OpenBioCardServer.csproj \
13+
-c Release -o /app/publish /p:UseAppHost=false
1114

12-
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
15+
FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION} AS runtime
1316
WORKDIR /app
1417

15-
# Create a non-root user for security (optional but recommended)
16-
# .NET 8 images already include a non-root user 'app', but we stick to default for simplicity
17-
# unless specific permission requirements exist.
18-
19-
COPY --from=build /app/publish .
20-
21-
# .NET 8 container images listen on port 8080 by default
22-
EXPOSE 8080
23-
24-
# Environment variables can be overridden in docker-compose or run command
2518
ENV ASPNETCORE_URLS=http://+:8080
19+
EXPOSE 8080
2620

21+
COPY --from=build /app/publish .
2722
ENTRYPOINT ["dotnet", "OpenBioCardServer.dll"]

0 commit comments

Comments
 (0)