Skip to content

Commit

Permalink
Two stage build in docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
mikescandy authored and PiotrJustyna committed Oct 20, 2021
1 parent 2aa32eb commit 9491309
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 26 deletions.
11 changes: 9 additions & 2 deletions 1/ops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@ RUN dotnet publish --verbosity normal "/src/SiloHost.csproj" --configuration Rel

EXPOSE 8080

CMD ["dotnet", "/SiloHost/SiloHost.dll"]
ENTRYPOINT ["/SiloHost/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine

WORKDIR /SiloHost
COPY --from=build /SiloHost ./
EXPOSE 3000 8080

CMD ["dotnet", "SiloHost.dll"]
ENTRYPOINT ["./entrypoint.sh"]
1 change: 0 additions & 1 deletion 3/ops/Client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ COPY ./ops/Client/entrypoint.sh /Client/

RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client


# final stage/image
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine

Expand Down
10 changes: 8 additions & 2 deletions 3a/ops/Client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ COPY ./ops/Client/entrypoint.sh /Client/

RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client

CMD ["dotnet", "/Client/Client.dll"]
ENTRYPOINT ["/Client/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine

WORKDIR /Client
COPY --from=build /Client ./

CMD ["dotnet", "Client.dll"]
ENTRYPOINT ["./entrypoint.sh"]
11 changes: 9 additions & 2 deletions 3a/ops/SiloHost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configur

EXPOSE 3000 8080

CMD ["dotnet", "/SiloHost/SiloHost.dll"]
ENTRYPOINT ["/SiloHost/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine

WORKDIR /SiloHost
COPY --from=build /SiloHost ./
EXPOSE 3000 8080

CMD ["dotnet", "SiloHost.dll"]
ENTRYPOINT ["./entrypoint.sh"]
10 changes: 8 additions & 2 deletions 3b/ops/Client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ COPY ./ops/Client/entrypoint.sh /Client/

RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client

CMD ["dotnet", "/Client/Client.dll"]
ENTRYPOINT ["/Client/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine

WORKDIR /Client
COPY --from=build /Client ./

CMD ["dotnet", "Client.dll"]
ENTRYPOINT ["./entrypoint.sh"]
11 changes: 9 additions & 2 deletions 3b/ops/SiloHost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,12 @@ RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configur

EXPOSE 3000 8080

CMD ["dotnet", "/SiloHost/SiloHost.dll"]
ENTRYPOINT ["/SiloHost/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine

WORKDIR /SiloHost
COPY --from=build /SiloHost ./
EXPOSE 3000 8080

CMD ["dotnet", "SiloHost.dll"]
ENTRYPOINT ["./entrypoint.sh"]
12 changes: 9 additions & 3 deletions 4/ops/Client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build

COPY ./Client/Client.csproj /src/Client/Client.csproj
COPY ./Client/src/* /src/Client/

Expand All @@ -10,5 +10,11 @@ COPY ./ops/Client/entrypoint.sh /Client/

RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client

CMD ["dotnet", "/Client/Client.dll"]
ENTRYPOINT ["/Client/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine

WORKDIR /Client
COPY --from=build /Client ./

CMD ["dotnet", "Client.dll"]
ENTRYPOINT ["./entrypoint.sh"]
11 changes: 9 additions & 2 deletions 4/ops/SiloHost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configur

EXPOSE 3000 8080

CMD ["dotnet", "/SiloHost/SiloHost.dll"]
ENTRYPOINT ["/SiloHost/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine

WORKDIR /SiloHost
COPY --from=build /SiloHost ./
EXPOSE 3000 8080

CMD ["dotnet", "SiloHost.dll"]
ENTRYPOINT ["./entrypoint.sh"]
10 changes: 8 additions & 2 deletions 5/ops/Client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ COPY ./ops/Client/entrypoint.sh /Client/

RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client

CMD ["dotnet", "/Client/Client.dll"]
ENTRYPOINT ["/Client/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine

WORKDIR /Client
COPY --from=build /Client ./

CMD ["dotnet", "Client.dll"]
ENTRYPOINT ["./entrypoint.sh"]
11 changes: 9 additions & 2 deletions 5/ops/SiloHost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,12 @@ RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configur

EXPOSE 3000 8080

CMD ["dotnet", "/SiloHost/SiloHost.dll"]
ENTRYPOINT ["/SiloHost/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine

WORKDIR /SiloHost
COPY --from=build /SiloHost ./
EXPOSE 3000 8080

CMD ["dotnet", "SiloHost.dll"]
ENTRYPOINT ["./entrypoint.sh"]
11 changes: 9 additions & 2 deletions 6/ops/SiloHost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,12 @@ RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configur

EXPOSE 3000 8080

CMD ["dotnet", "/SiloHost/SiloHost.dll"]
ENTRYPOINT ["/SiloHost/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine

WORKDIR /SiloHost
COPY --from=build /SiloHost ./
EXPOSE 3000 8080

CMD ["dotnet", "SiloHost.dll"]
ENTRYPOINT ["./entrypoint.sh"]
11 changes: 9 additions & 2 deletions 7/ops/SiloHost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,12 @@ RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configur

EXPOSE 3000 8080

CMD ["dotnet", "/SiloHost/SiloHost.dll"]
ENTRYPOINT ["/SiloHost/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine

WORKDIR /SiloHost
COPY --from=build /SiloHost ./
EXPOSE 3000 8080

CMD ["dotnet", "SiloHost.dll"]
ENTRYPOINT ["./entrypoint.sh"]
11 changes: 9 additions & 2 deletions 8/ops/SiloHost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,12 @@ RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configur

EXPOSE 3000 8080

CMD ["dotnet", "/SiloHost/SiloHost.dll"]
ENTRYPOINT ["/SiloHost/entrypoint.sh"]
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine

WORKDIR /SiloHost
COPY --from=build /SiloHost ./
EXPOSE 3000 8080

CMD ["dotnet", "SiloHost.dll"]
ENTRYPOINT ["./entrypoint.sh"]

0 comments on commit 9491309

Please sign in to comment.