-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (28 loc) · 1.12 KB
/
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
# ----------------------------------------------------------------
# 1st stage: build component
# ----------------------------------------------------------------
# base image
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS builder
WORKDIR /app
# copy csproj and restore as distinct layers
COPY ./src/*.csproj ./src/
RUN dotnet restore ./src/*.csproj
# copy everything else and build
COPY ./src/ ./src/
RUN dotnet publish ./src/*.csproj -c Release -o /app/dist
# ----------------------------------------------------------------
# 2nd stage: build production ready image
# ----------------------------------------------------------------
# base image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
WORKDIR /app
# expose the environment variable that dotnet uses to determine the active profile. Possible values are "", "Development", "Staging", "Production"
ENV ASPNETCORE_ENVIRONMENT ""
# copy artifact build from the 'build environment'
COPY --from=builder /app/dist .
COPY /scripts/entrypoint.sh /app/
# expose http port
EXPOSE 5000
# expose https port
EXPOSE 5001
ENTRYPOINT ["dotnet", "dotnet projectAssemblyName.api.dll"]