-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (23 loc) · 965 Bytes
/
Copy pathDockerfile
File metadata and controls
32 lines (23 loc) · 965 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
# Stage 1: Build the application using the .NET 9 SDK
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
# Copy solution and project files
COPY ["gstream.sln", "./"]
COPY ["gstream.csproj", "./"]
# Restore dependencies using the solution file for better context
RUN dotnet restore "gstream.sln"
# Copy the rest of the application source code
COPY . .
# Publish the application, referencing the project file directly
RUN dotnet publish "gstream.csproj" -c Release -o /app/publish
# Stage 2: Create the final runtime image using the .NET 9 runtime
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
WORKDIR /app
# --- THIS IS THE FIX ---
# Install curl so the healthcheck in docker-compose.yml can run
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
COPY --from=build /app/publish .
# Expose the port the application will run on
EXPOSE 8080
# Define the entry point for the container
ENTRYPOINT ["dotnet", "gstream.dll"]