-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
27 lines (22 loc) · 825 Bytes
/
Dockerfile
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
# Use the official ASP.NET runtime image as a parent image
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
# Use the SDK image to build the app
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Copy the csproj file and restore the dependencies
COPY ["OccupancyTracker/OccupancyTracker.csproj", "OccupancyTracker/"]
RUN dotnet restore "OccupancyTracker/OccupancyTracker.csproj"
# Copy the rest of the project files
COPY . .
WORKDIR "/src/OccupancyTracker"
RUN dotnet build "OccupancyTracker.csproj" -c Release -o /app/build
# Publish the app
FROM build AS publish
RUN dotnet publish "OccupancyTracker.csproj" -c Release -o /app/publish
# Use the base image to run the app
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "OccupancyTracker.dll"]