-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (27 loc) · 1.21 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
# set base image as the dotnet 8.0 SDK.
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
# set the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD
# instructions that follows the WORKDIR instruction.
WORKDIR /app
# our current working directory within the container is /app
# we now copy all the files (from local machine) to /app (in the container).
COPY . ./
# run unit tests within the solution.
# RUN dotnet test Bejebeje.Api.sln
# again, on the container (we are in /app folder)
# we now publish the project into a folder called 'out'.
RUN dotnet publish Bejebeje.Mvc/Bejebeje.Mvc.csproj -c Release -o out
# set base image as the dotnet 8.0 runtime.
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
# telling the application what port to run on.
ENV ASPNETCORE_URLS=http://*:5005
# disable diagnostics
ENV COMPlus_EnableDiagnostics=0
# set the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD
# instructions that follows the WORKDIR instruction.
WORKDIR /app
# copy the contents of /app/out in the `build-env` and paste it in the
# `/app` directory of the new runtime container.
COPY --from=build-env /app/out .
# set the entry point into the application.
ENTRYPOINT ["dotnet", "Bejebeje.Mvc.dll"]