generated from trihugger/dotnet-webapi-boilerplate
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
55 lines (48 loc) · 2.38 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal AS base
ENV ASPNETCORE_URLS=https://+:5050;http://+:5060
WORKDIR /app
EXPOSE 5050
EXPOSE 5060
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-dotnet-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS build
WORKDIR /
COPY ["Directory.Build.props", "/"]
COPY ["src/Bootstrapper/Bootstrapper.csproj", "src/Bootstrapper/"]
COPY ["src/Core/Domain/Domain.csproj", "src/Core/Domain/"]
COPY ["src/Core/Application/Application.csproj", "src/Core/Application/"]
COPY ["src/Infrastructure/Infrastructure.csproj", "src/Infrastructure/"]
COPY ["src/Migrators/Migrators.MSSQL/Migrators.MSSQL.csproj", "src/Migrators/Migrators.MSSQL/"]
COPY ["src/Migrators/Migrators.MySQL/Migrators.MySQL.csproj", "src/Migrators/Migrators.MySQL/"]
COPY ["src/Migrators/Migrators.PostgreSQL/Migrators.PostgreSQL.csproj", "src/Migrators/Migrators.PostgreSQL/"]
COPY ["src/Shared/Shared.DTOs/Shared.DTOs.csproj", "src/Shared/Shared.DTOs/"]
COPY ["/dotnet.ruleset", "src/Bootstrapper/"]
COPY ["/dotnet.ruleset", "src/Core/Domain/"]
COPY ["/dotnet.ruleset", "src/Core/Application/"]
COPY ["/dotnet.ruleset", "src/Infrastructure/"]
COPY ["/dotnet.ruleset", "src/Migrators/Migrators.MSSQL/"]
COPY ["/dotnet.ruleset", "src/Migrators/Migrators.MySQL/"]
COPY ["/dotnet.ruleset", "src/Migrators/Migrators.PostgreSQL/"]
COPY ["/dotnet.ruleset", "src/Shared/Shared.DTOs/"]
COPY ["/stylecop.json", "src/Bootstrapper/"]
COPY ["/stylecop.json", "src/Core/Domain/"]
COPY ["/stylecop.json", "src/Core/Application/"]
COPY ["/stylecop.json", "src/Infrastructure/"]
COPY ["/stylecop.json", "src/Migrators/Migrators.MSSQL/"]
COPY ["/stylecop.json", "src/Migrators/Migrators.MySQL/"]
COPY ["/stylecop.json", "src/Migrators/Migrators.PostgreSQL/"]
COPY ["/stylecop.json", "src/Shared/Shared.DTOs/"]
RUN dotnet restore "src/Bootstrapper/Bootstrapper.csproj" --disable-parallel
COPY . .
WORKDIR "/src/Bootstrapper"
RUN dotnet build "Bootstrapper.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Bootstrapper.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
WORKDIR /app/Files
WORKDIR /app
ENTRYPOINT ["dotnet", "DN.WebApi.Bootstrapper.dll"]