Navigation Menu

Skip to content

Commit

Permalink
Multi-stage Docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
lyphtec committed Oct 10, 2017
1 parent 2961cf4 commit e7b04d9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Expand Up @@ -16,7 +16,7 @@ services:
image: node-api
container_name: node-api
build: ./src/node-api
links:
depends_on:
- idserv
environment:
NODE_ENV: development
Expand All @@ -35,7 +35,7 @@ services:
build: ./src/client
environment:
NODE_ENV: development
links:
depends_on:
- idserv
- api
ports:
Expand Down
14 changes: 8 additions & 6 deletions src/idserv4/Dockerfile
@@ -1,14 +1,16 @@
FROM microsoft/dotnet:2-sdk

# Using multi stage build as per https://docs.docker.com/engine/examples/dotnetcore/
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app

COPY ["idserv4.csproj", "./"]

RUN dotnet restore

COPY . .
RUN dotnet publish -c Debug -o out

RUN dotnet publish -c Debug

# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
EXPOSE 5000
ENTRYPOINT ["dotnet", "run"]
ENTRYPOINT ["dotnet", "IdServ.dll"]
15 changes: 15 additions & 0 deletions src/idserv4/idserv4.csproj
Expand Up @@ -17,4 +17,19 @@
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<None Update="cert.pfx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

0 comments on commit e7b04d9

Please sign in to comment.