Last active
January 27, 2019 13:18
-
-
Save haf/1078452fbbee851c63733cee6c45597b to your computer and use it in GitHub Desktop.
Using multi-stage docker build with smart caching of dependencies
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.2-sdk as build | |
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ | |
DEBIAN_FRONTEND=noninteractive apt-get install -y locales && \ | |
locale-gen C C.UTF-8 && \ | |
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales && \ | |
DEBIAN_FRONTEND=noninteractive apt-get install -y git vim libczmq4 libprotobuf-c-dev libprotobuf-dev libprotobuf10 ca-certificates | |
ENV LC_ALL=C.UTF-8 | |
WORKDIR /build/ | |
COPY paket.dependencies paket.lock ./ | |
RUN dotnet tool install --tool-path $PWD/.paket Paket | |
RUN .paket/paket restore | |
COPY . . | |
RUN dotnet restore src/Logary.sln | |
RUN ./fake.sh build | |
FROM microsoft/dotnet:2.2-runtime | |
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ | |
DEBIAN_FRONTEND=noninteractive apt-get install -y locales && \ | |
locale-gen C C.UTF-8 && \ | |
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales && \ | |
DEBIAN_FRONTEND=noninteractive apt-get install -y libczmq4 libprotobuf-c-dev libprotobuf10 ca-certificates | |
WORKDIR /logary/ | |
COPY --from=build /build/src/services/Logary.Services.Rutta/bin/Release/netcoreapp2.2/publish/* /logary/ | |
ENTRYPOINT ["dotnet", "/logary/rutta.dll"] | |
CMD [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment