-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (37 loc) · 1.54 KB
/
Dockerfile
File metadata and controls
46 lines (37 loc) · 1.54 KB
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
39
40
41
42
43
44
45
46
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
# Copy solution and all .csproj files
COPY *.sln ./
COPY src/TheOfficeAPI/*.csproj ./src/TheOfficeAPI/
COPY tests/TheOfficeAPI.Level0.Tests.Unit/*.csproj ./tests/TheOfficeAPI.Level0.Tests.Unit/
COPY tests/TheOfficeAPI.Level0.Tests.Integration/*.csproj ./tests/TheOfficeAPI.Level0.Tests.Integration/
COPY tests/TheOfficeAPI.Level1.Tests.Unit/*.csproj ./tests/TheOfficeAPI.Level1.Tests.Unit/
COPY tests/TheOfficeAPI.Level1.Tests.Integration/*.csproj ./tests/TheOfficeAPI.Level1.Tests.Integration/
COPY tests/TheOfficeAPI.Level2.Tests.Unit/*.csproj ./tests/TheOfficeAPI.Level2.Tests.Unit/
COPY tests/TheOfficeAPI.Level2.Tests.Integration/*.csproj ./tests/TheOfficeAPI.Level2.Tests.Integration/
COPY tests/TheOfficeAPI.Level3.Tests.Unit/*.csproj ./tests/TheOfficeAPI.Level3.Tests.Unit/
COPY tests/TheOfficeAPI.Level3.Tests.Integration/*.csproj ./tests/TheOfficeAPI.Level3.Tests.Integration/
COPY tests/TheOfficeAPI.Tests.E2E/*.csproj ./tests/TheOfficeAPI.Tests.E2E/
# Restore dependencies
RUN dotnet restore TheOfficeAPI.sln
# Copy rest of the code
COPY . ./
# Publish main project
RUN dotnet publish src/TheOfficeAPI/TheOfficeAPI.csproj \
-c Release \
-o /app/out \
--no-restore
# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
# Copy compiled files
COPY --from=build /app/out .
# Set environment
ENV ASPNETCORE_ENVIRONMENT=Production
ENV PORT=8080
ENV MATURITY_LEVEL=Level0
# Expose port 8080
EXPOSE 8080
# Entry point
ENTRYPOINT ["dotnet", "TheOfficeAPI.dll"]