-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
38 lines (30 loc) · 892 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
28
29
30
31
32
33
34
35
36
37
38
# Base stage for running the app
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
# Set the ASP.NET Core URLs to listen on port 8080
ENV ASPNETCORE_URLS=http://+:8080
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /app
# Copy project files and restore dependencies
COPY *.csproj .
RUN dotnet restore "TodoAppAPI.csproj"
COPY . .
RUN dotnet build "TodoAppAPI.csproj" -c $BUILD_CONFIGURATION -o /app/build
# Publish stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "TodoAppAPI.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# Final stage for production
FROM base AS final
WORKDIR /app
# Copy published app
COPY --from=publish /app/publish .
# Expose port 8080
EXPOSE 8080
RUN whoami
RUN env
RUN pwd && ls -l
# Set the entrypoint
ENTRYPOINT ["dotnet", "TodoAppAPI.dll"]