Skip to content

Instantly share code, notes, and snippets.

@jfbueno
Last active November 11, 2020 23:09
Show Gist options
  • Save jfbueno/af96d755c9966ab82dcc5537d45816a8 to your computer and use it in GitHub Desktop.
Save jfbueno/af96d755c9966ab82dcc5537d45816a8 to your computer and use it in GitHub Desktop.
version: "3.8"
services:
banco:
image: mcr.microsoft.com/mssql/server:2019-GA-ubuntu-16.04
container_name: sqlserver
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=bX42V5oOZ7Bg
- MSSQL_PID=Developer
ports:
- "5433:1433"
volumes:
- /var/opt/mssql
networks:
- tarefas_app
tarefas:
container_name: tarefas
build:
context: ../
dockerfile: src/Servicos/Tarefas/Dockerfile
environment:
- ASPNETCORE_ENVIRONMENT=Staging
- ConnectionStrings__Default=Server=banco;Database=TarefasDb;User Id=sa;Password=bX42V5oOZ7Bg;
ports:
- "8081:80"
networks:
- tarefas_app
depends_on:
- banco
usuarios:
container_name: usuarios
build:
context: ../
dockerfile: src/Servicos/Usuarios/Dockerfile
environment:
- ASPNETCORE_ENVIRONMENT=Staging
- ConnectionStrings__Default=Server=banco;Database=UsuariosDb;User Id=sa;Password=bX42V5oOZ7Bg;
ports:
- "8082:80"
networks:
- tarefas_app
depends_on:
- banco
networks:
tarefas_app:
driver: bridge
# API de Usuários
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.4-buster-slim AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster as build
WORKDIR /src
COPY ["src/BuildingBlocks/NucleoCompartilhado/NucleoCompartilhado.csproj", "BuildingBlocks/NucleoCompartilhado/"]
COPY ["src/Servicos/Usuarios/Usuarios.csproj", "Servicos/Usuarios/"]
RUN dotnet restore "./Servicos/Usuarios/Usuarios.csproj"
COPY ["src/BuildingBlocks/NucleoCompartilhado/", "BuildingBlocks/NucleoCompartilhado/"]
COPY ["src/Servicos/Usuarios/", "Servicos/Usuarios/"]
WORKDIR /src/Servicos/Usuarios
FROM build AS publish
RUN dotnet publish "Usuarios.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
ENTRYPOINT ["dotnet", "Usuarios.dll"]
# API de Tarefas
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.4-buster-slim AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster as build
WORKDIR /src
COPY ["src/BuildingBlocks/NucleoCompartilhado/NucleoCompartilhado.csproj", "BuildingBlocks/NucleoCompartilhado/"]
COPY ["src/Servicos/Tarefas/Tarefas.csproj", "Servicos/Tarefas/"]
RUN dotnet restore "./Servicos/Tarefas/Tarefas.csproj"
COPY ["src/BuildingBlocks/NucleoCompartilhado/", "BuildingBlocks/NucleoCompartilhado/"]
COPY ["src/Servicos/Tarefas/", "Servicos/Tarefas/"]
WORKDIR /src/Servicos/Tarefas
FROM build AS publish
RUN dotnet publish "Tarefas.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
ENTRYPOINT ["dotnet", "Tarefas.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment