-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 771 Bytes
/
Dockerfile
File metadata and controls
36 lines (27 loc) · 771 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
31
32
33
34
35
36
# Build Stage
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build-env
WORKDIR /src
ARG git_branch
RUN mkdir -p /root/.nuget/NuGet
COPY ./config/NuGetPackageSource.Config /root/.nuget/NuGet/NuGet.Config
COPY ./src .
ENV ASPNETCORE_ENVIRONMENT=$git_branch
# Copy only .csproj and restore
COPY ./src/Api/*.csproj ./Api/
RUN dotnet restore ./Api/
# Copy everything else and build
COPY ./src/Api ./Api/
RUN dotnet build ./Api/
# Publish
RUN dotnet publish ./Api/ -o /publish --configuration Release
RUN ls /publish
# Publish Stage
FROM mcr.microsoft.com/dotnet/aspnet:9.0
ARG git_branch
WORKDIR /app
COPY --from=build-env /publish .
ENV port=80
ARG git_branch
ENV ASPNETCORE_ENVIRONMENT=$git_branch
ENV ASPNETCORE_URLS=http://+:$port
ENTRYPOINT ["dotnet", "Api.dll"]