-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (23 loc) · 792 Bytes
/
Dockerfile
File metadata and controls
29 lines (23 loc) · 792 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
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Copy the solution file and restore dependencies
COPY WorkoutHelper-Docker.sln .
COPY WorkoutHelper.Shared/WorkoutHelper.Shared.csproj ./WorkoutHelper.Shared/
COPY WorkoutHelperAPI/WorkoutHelperAPI.csproj ./WorkoutHelperAPI/
RUN dotnet restore
# Copy the rest of the source code and build the API project
COPY . .
WORKDIR /src/WorkoutHelperAPI
RUN dotnet build -c Release -o /app/build
# Publish stage
FROM build AS publish
RUN dotnet publish -c Release -o /app/publish
# Runtime stage
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS runtime
WORKDIR /app
COPY --from=publish /app/publish .
# Expose the port your application will run on
EXPOSE 8080
# Start the application
ENTRYPOINT ["dotnet", "WorkoutHelperAPI.dll"]