-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (26 loc) · 1.09 KB
/
Copy pathDockerfile
File metadata and controls
34 lines (26 loc) · 1.09 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
# Stage 1: Build the application
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
# Copy the Solution file and Project files first (for better caching)
COPY ["CryptoMonitor.sln", "./"]
COPY ["UI-MVC/UI-MVC.csproj", "UI-MVC/"]
COPY ["CryptoMonitor.BL/CryptoMonitor.BL.csproj", "CryptoMonitor.BL/"]
COPY ["CryptoMonitor.DAL/CryptoMonitor.DAL.csproj", "CryptoMonitor.DAL/"]
COPY ["CryptoMonitor.Domain/CryptoMonitor.Domain.csproj", "CryptoMonitor.Domain/"]
COPY ["CryptoMonitor.UI.CA/CryptoMonitor.UI.CA.csproj", "CryptoMonitor.UI.CA/"]
# Restore dependencies
RUN dotnet restore "CryptoMonitor.sln"
# Copy the rest of the source code
COPY . .
# ✅ Build and Publish the MVC project (fixed path)
WORKDIR "/src/UI-MVC"
RUN dotnet publish "UI-MVC.csproj" -c Release -o /app/publish
# Stage 2: Run the application
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
WORKDIR /app
COPY --from=build /app/publish .
# Create a directory for the database to ensure permissions are right
RUN mkdir -p /app/data
# Expose port 8080 (Standard for .NET containers)
EXPOSE 8080
ENTRYPOINT ["dotnet", "UI-MVC.dll"]