-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (22 loc) · 754 Bytes
/
Dockerfile
File metadata and controls
30 lines (22 loc) · 754 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
# 1) Runtime image for running the app
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 8080
ENV ASPNETCORE_URLS=http://+:8080
# 2) Build image (SDK) for restore/build/publish
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Copy only the csproj first (better caching)
COPY ["JobPosting.csproj", "./"]
# Restore dependencies
RUN dotnet restore "JobPosting.csproj"
# Copy the rest of the source (now without bin/obj, thanks to .dockerignore)
COPY . .
# Build and publish
RUN dotnet publish "JobPosting.csproj" -c Release -o /app/publish /p:UseAppHost=false
# 3) Final runtime image
FROM base AS final
WORKDIR /app
# Copy from build stage
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "JobPosting.dll"]