-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (23 loc) · 869 Bytes
/
Dockerfile
File metadata and controls
33 lines (23 loc) · 869 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
# 1. Use the official .NET SDK image for building
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
# Copy the solution and project files
COPY ["Refhub/Refhub.csproj", "Refhub/"]
COPY ["Refhub.sln", "./"]
# Restore dependencies
RUN dotnet restore "Refhub/Refhub.csproj"
# Copy the rest of the project (important!)
COPY ./Refhub ./Refhub
WORKDIR "/src/Refhub"
# Optional: copy Docker-specific config if needed
# COPY ./Refhub/appsettings.Docker.json ./Refhub/appsettings.Docker.json
RUN dotnet build "Refhub.csproj" -c Release -o /app/build
# 2. Publish the app
FROM build AS publish
RUN dotnet publish "Refhub.csproj" -c Release -o /app/publish
# 3. Use the ASP.NET runtime image for the final stage
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
WORKDIR /app
EXPOSE 8080
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Refhub.dll"]