Created
May 29, 2019 19:44
-
-
Save diegodfsd/f89ab8db1045222a93a3264264c1a9e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
app: | |
build: | |
context: . | |
dockerfile: ./app/Dockerfile | |
ports: | |
- "5000" | |
networks: | |
- nexp-network | |
proxy: | |
build: | |
context: . | |
dockerfile: ./proxy/Dockerfile | |
ports: | |
- "80:80" | |
links: | |
- app | |
networks: | |
- nexp-network | |
networks: | |
nexp-network: | |
driver: bridge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM microsoft/dotnet:2.1-sdk AS build | |
WORKDIR /app | |
# Copiar source e restaurar dependencias | |
COPY ./Nexp.sln ./ | |
COPY ./NuGet.config ./ | |
COPY ./server/core/Domain/Nexp.Core.Application/Nexp.Core.Application.csproj ./server/core/Domain/Nexp.Core.Application/ | |
COPY ./server/core/Domain/Nexp.Core.CQRS/Nexp.Core.CQRS.csproj ./server/core/Domain/Nexp.Core.CQRS/ | |
COPY ./server/core/Domain/Nexp.Core.Domain.Model/Nexp.Core.Domain.Model.csproj ./server/core/Domain/Nexp.Core.Domain.Model/ | |
COPY ./server/core/Domain/Nexp.Core.Domain.Service/Nexp.Core.Domain.Service.csproj ./server/core/Domain/Nexp.Core.Domain.Service/ | |
COPY ./server/core/Domain/Nexp.Core.Domain.Events/Nexp.Core.Domain.Events.csproj ./server/core/Domain/Nexp.Core.Domain.Events/ | |
COPY ./server/core/Infra/Nexp.Infra.Database/Nexp.Infra.Database.csproj ./server/core/Infra/Nexp.Infra.Database/ | |
COPY ./server/core/Infra/Nexp.Infra.Data/Nexp.Infra.Data.csproj ./server/core/Infra/Nexp.Infra.Data/ | |
COPY ./server/core/Infra/Nexp.Infra.Support/Nexp.Infra.Support.csproj ./server/core/Infra/Nexp.Infra.Support/ | |
COPY ./server/tests/Nexp.UnitTests/Nexp.UnitTests.csproj ./server/tests/Nexp.UnitTests/ | |
COPY ./server/web/Nexp.Web.Api/Nexp.Web.Api.csproj ./server/web/Nexp.Web.Api/ | |
# RUN dotnet clean | |
RUN dotnet restore --configfile NuGet.config | |
# Build da aplicacao | |
COPY ./server ./server | |
RUN dotnet build -c Release --no-restore | |
RUN dotnet publish "./server/web/Nexp.Web.Api/Nexp.Web.Api.csproj" -c Release -o /out | |
# Build da imagem | |
FROM microsoft/dotnet:2.1-aspnetcore-runtime | |
WORKDIR /app | |
ENV ASPNETCORE_ENVIRONMENT=Production | |
ENV ASPNETCORE_URLS http://+:5000 | |
EXPOSE 5000 | |
COPY --from=build ./out . | |
ENTRYPOINT ["dotnet", "Nexp.Web.Api.dll"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nginx | |
EXPOSE 80 | |
RUN rm /etc/nginx/nginx.conf | |
COPY ./proxy/nginx.conf /etc/nginx/nginx.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 4; | |
events { worker_connections 1024; } | |
http { | |
sendfile on; | |
upstream app_servers { | |
least_conn; | |
server 127.0.0.1:5000; | |
# server app:5000; | |
} | |
server { | |
listen 80; | |
location / { | |
proxy_pass http://app_servers; | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Host $server_name; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment