-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.v
52 lines (40 loc) · 1.4 KB
/
Dockerfile.v
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
# syntax=docker/dockerfile:1
#FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
#WORKDIR /app
# Copy csproj and restore as distinct layers
#COPY *.csproj ./
#RUN dotnet restore
# Copy everything else and build
#COPY . ./
#RUN dotnet publish -c Release -o out
# Build runtime image
#FROM mcr.microsoft.com/dotnet/aspnet:5.0
#WORKDIR /app
#EXPOSE 80
#COPY --from=build-env /app/out .
#ENTRYPOINT ["dotnet", "dotnet-webapi.dll"]
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
##EXPOSE 8080
##ENV ASPNETCORE_URLS=http://*:$PORT
# 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:5.0 AS build
WORKDIR /src
COPY ["dotnet-webapi.csproj", "./"]
RUN dotnet restore "dotnet-webapi.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "dotnet-webapi.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "dotnet-webapi.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "dotnet-webapi.dll"]
# ENTRYPOINT ["dotnet", "dotnet-webapi.dll"]
# Padrão de container ASP.NET
# Opção utilizada pelo Heroku
CMD ASPNETCORE_URLS=http://*:$PORT dotnet dotnet-webapi.dll