Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master 153996b72 -> b8abcd675


GUACAMOLE-408: revise Dockerfile to use multi-stage image build


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/5c07e4a4
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/5c07e4a4
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/5c07e4a4

Branch: refs/heads/master
Commit: 5c07e4a4eeabf68c5fa1ea24ced373ac8d697bbf
Parents: 153996b
Author: Carl Harris <[email protected]>
Authored: Sat Oct 7 10:07:20 2017 -0400
Committer: Carl Harris <[email protected]>
Committed: Sat Oct 7 10:07:20 2017 -0400

----------------------------------------------------------------------
 Dockerfile | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5c07e4a4/Dockerfile
----------------------------------------------------------------------
diff --git a/Dockerfile b/Dockerfile
index bd8131f..ebc3cb0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,29 +21,36 @@
 # Dockerfile for guacamole-client
 #
 
-# Start from Tomcat image
-FROM tomcat:8.0.20-jre8
+# Use args for Tomcat image label to allow image builder to choose alternatives
+# such as `--build-arg TOMCAT_JRE=jre8-alpine`
+#
+ARG TOMCAT_VERSION=8.0.20
+ARG TOMCAT_JRE=jre8
+
+# Use official maven image for the build
+FROM maven:3-jdk-8 AS builder
 
-# Environment variables
+# Build environment variables
 ENV \
-    BUILD_DIR=/tmp/guacamole-docker-BUILD \
-    BUILD_DEPENDENCIES="                  \
-        maven                             \
-        openjdk-8-jdk-headless"
+    BUILD_DIR=/tmp/guacamole-docker-BUILD
 
 # Add configuration scripts
-COPY guacamole-docker/bin /opt/guacamole/bin/
+COPY guacamole-docker/bin/ /opt/guacamole/bin/
 
 # Copy source to container for sake of build
 COPY . "$BUILD_DIR"
 
-# Build latest guacamole-client and authentication
-RUN apt-get update                                                    && \
-    apt-get install -y --no-install-recommends $BUILD_DEPENDENCIES    && \
-    /opt/guacamole/bin/build-guacamole.sh "$BUILD_DIR" /opt/guacamole && \
-    rm -Rf "$BUILD_DIR"                                               && \
-    rm -Rf /var/lib/apt/lists/*                                       && \
-    apt-get purge -y --auto-remove $BUILD_DEPENDENCIES
+# Run the build itself
+RUN /opt/guacamole/bin/build-guacamole.sh "$BUILD_DIR" /opt/guacamole
+
+# For the runtime image, we start with the official Tomcat distribution
+FROM tomcat:${TOMCAT_VERSION}-${TOMCAT_JRE}
+
+# This is where the build artifacts go in the runtime image
+WORKDIR /opt/guacamole
+
+# Copy artifacts from builder image into this image
+COPY --from=builder /opt/guacamole/ .
 
 # Start Guacamole under Tomcat, listening on 0.0.0.0:8080
 EXPOSE 8080

Reply via email to