From 8a99f4564a725caf226861fde8f9ddf2c8ebe5e5 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Thu, 29 Nov 2018 00:51:18 +0100 Subject: [PATCH] Use a multi stage docker build and build app in release mode --- Dockerfile | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 38d854c..a3800c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,28 @@ -FROM dlang2/dmd-ubuntu +FROM dlang2/dmd-ubuntu:2.083.0 as build WORKDIR /dlang/vibe-docker COPY . . -RUN useradd --user-group --create-home --shell /bin/false app -RUN chown -R app:app /dlang/vibe-docker +RUN useradd --user-group --create-home --shell /bin/false app && \ + chown -R app:app /dlang/vibe-docker USER app -RUN dub build +RUN dub build --build=release + +FROM ubuntu:17.10 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN set -ex && \ + apt-get update && \ + apt-get install --no-install-recommends -y \ + ca-certificates \ + libssl1.0.0 + +COPY --from=build /dlang/vibe-docker/vibe-docker /dlang/vibe-docker/vibe-docker + +RUN useradd --user-group --create-home --shell /bin/false app && \ + chown -R app:app /dlang/vibe-docker +USER app EXPOSE 8080