Skip to content

Instantly share code, notes, and snippets.

@felipebossolani
Last active December 16, 2019 14:57
Show Gist options
  • Save felipebossolani/0d85aa27626f7cdb7e93b297095e2da3 to your computer and use it in GitHub Desktop.
Save felipebossolani/0d85aa27626f7cdb7e93b297095e2da3 to your computer and use it in GitHub Desktop.
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
#docker build -t meuportfolio-api .
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["MeuPortfolio.PortfolioManagement/MeuPortfolio.PortfolioManagement.Api.csproj", "MeuPortfolio.PortfolioManagement.Api/"]
COPY ["MeuPortfolio.PortfolioManagement/MeuPortfolio.PortfolioManagement.Domain/MeuPortfolio.PortfolioManagement.Domain.csproj", "MeuPortfolio.PortfolioManagement.Domain/"]
COPY ["MeuPortfolio.PortfolioManagement/MeuPortfolio.PortfolioManagement.Shared/MeuPortfolio.PortfolioManagement.Shared.csproj", "MeuPortfolio.PortfolioManagement.Shared/"]
COPY ["MeuPortfolio.PortfolioManagement/MeuPortfolio.PortfolioManagement.Infra.SQL/MeuPortfolio.PortfolioManagement.Infra.SQL.csproj", "MeuPortfolio.PortfolioManagement.Infra.SQL/"]
COPY ["MeuPortfolio.PortfolioManagement/MeuPortfolio.PortfolioManagement.Infra.File/MeuPortfolio.PortfolioManagement.Infra.File.csproj", "MeuPortfolio.PortfolioManagement.Infra.File/"]
RUN dotnet restore "MeuPortfolio.PortfolioManagement.Api/MeuPortfolio.PortfolioManagement.Api.csproj"
COPY . .
WORKDIR /src/MeuPortfolio.PortfolioManagement.Api
RUN dotnet build "MeuPortfolio.PortfolioManagement.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "MeuPortfolio.PortfolioManagement.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MeuPortfolio.PortfolioManagement.Api.dll", "--server.urls", "http://+:80;https://+:443"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment