-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (25 loc) · 984 Bytes
/
Dockerfile
File metadata and controls
34 lines (25 loc) · 984 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
34
# -------- Build Stage --------
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Copy solution and project files
COPY StudentManagementSystem.sln ./
COPY StudentManagementSystem/*.csproj ./StudentManagementSystem/
COPY StudentManagementSystem.Core/*.csproj ./StudentManagementSystem.Core/
COPY StudentManagementSystem.Infrastructure/*.csproj ./StudentManagementSystem.Infrastructure/
# Restore dependencies
RUN dotnet restore StudentManagementSystem/StudentManagementSystem.csproj
# Copy the rest of the source code
COPY . .
# Publish the app
RUN dotnet publish StudentManagementSystem/StudentManagementSystem.csproj -c Release -o /app/publish
# -------- Runtime Stage --------
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
WORKDIR /app
# Copy app
COPY --from=build /app/publish .
# Environment variables
ENV ASPNETCORE_URLS=http://+:10000
ENV ASPNETCORE_ENVIRONMENT=Production
EXPOSE 10000
# Run the app
ENTRYPOINT ["dotnet", "StudentManagementSystem.dll"]