Skip to content

Instantly share code, notes, and snippets.

@edueo
Created December 7, 2018 14:39
Show Gist options
  • Save edueo/429c25cc67f329621b7b50e7af1384d0 to your computer and use it in GitHub Desktop.
Save edueo/429c25cc67f329621b7b50e7af1384d0 to your computer and use it in GitHub Desktop.
Dockerfile Persona API
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# CONSIDERAÇÕES #
# - As imagens do alpine da Microsoft são para o .NET CORE 2.1 #
# - Utiliza dois containers para a montagem da imagem (Multisgage) #
# - Container compila, e as dlls são enviadas para um novo #
# - Cada um possui uma imagem base especifica #
# - A variável de ambiente "ASPNETCORE_URLS" é obrigatória para o #
# bind #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
FROM microsoft/dotnet-nightly:2.0-sdk AS build
LABEL MAINTAINER="Rubens Gomes"
WORKDIR usr/application
# Compila o projeto
COPY . .
RUN dotnet publish -r debian-x64 -c release -o binaries
# Container final nomade
FROM microsoft/dotnet-nightly:2.0-runtime
# Instalação da libunwind8 necessária (Issue: https://github.com/dotnet/cli/issues/3390)
RUN apt-get -y update \
&& apt-get -y upgrade \
&& apt-get -y install libunwind8 \
&& apt-get clean
WORKDIR usr/application
# Copia os binários do outro container
COPY --from=build usr/application/persona.api.webapi/binaries .
ENV ASPNETCORE_URLS=http://+:5000
EXPOSE 5000/tcp
ENTRYPOINT ["dotnet", "persona.api.webapi.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment