Skip to content

Instantly share code, notes, and snippets.

@haf
Last active January 27, 2019 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haf/1078452fbbee851c63733cee6c45597b to your computer and use it in GitHub Desktop.
Save haf/1078452fbbee851c63733cee6c45597b to your computer and use it in GitHub Desktop.
Using multi-stage docker build with smart caching of dependencies
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