You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2018/01/19 21:38:54 UTC

[1/2] guacamole-server git commit: GUACAMOLE-456: use Docker multi-stage build

Repository: guacamole-server
Updated Branches:
  refs/heads/master 11605ff5e -> 0f78b01e8


GUACAMOLE-456: use Docker multi-stage build


Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/e4f4761c
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/e4f4761c
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/e4f4761c

Branch: refs/heads/master
Commit: e4f4761c8781dfc48c7b746cfad22cb8e4f490c7
Parents: 2c12c12
Author: Carl Harris <ce...@vt.edu>
Authored: Wed Dec 6 07:57:12 2017 -0500
Committer: Carl Harris <ce...@vt.edu>
Committed: Wed Dec 6 07:57:12 2017 -0500

----------------------------------------------------------------------
 .dockerignore                       |   2 +
 Dockerfile                          | 110 +++++++++++++++++++++----------
 src/guacd-docker/bin/build-guacd.sh |  27 ++------
 3 files changed, 85 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/e4f4761c/.dockerignore
----------------------------------------------------------------------
diff --git a/.dockerignore b/.dockerignore
index 3e08b9a..6e10643 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,3 +1,5 @@
+# Docker build spec
+Dockerfile
 
 # Git repository metadata
 .git

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/e4f4761c/Dockerfile
----------------------------------------------------------------------
diff --git a/Dockerfile b/Dockerfile
index bbcd254..0e7ab0f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,31 +21,20 @@
 # Dockerfile for guacamole-server
 #
 
-# Start from CentOS base image
-FROM centos:centos7
-
-# Environment variables
-ENV \
-    BUILD_DIR=/tmp/guacd-docker-BUILD \
-    LC_ALL=en_US.UTF-8                \
-    RUNTIME_DEPENDENCIES="            \
-        cairo                         \
-        dejavu-sans-mono-fonts        \
-        freerdp                       \
-        freerdp-plugins               \
-        ghostscript                   \
-        libjpeg-turbo                 \
-        libssh2                       \
-        liberation-mono-fonts         \
-        libtelnet                     \
-        libvorbis                     \
-        libvncserver                  \
-        libwebp                       \
-        pango                         \
-        pulseaudio-libs               \
-        terminus-fonts                \
-        uuid"                         \
-    BUILD_DEPENDENCIES="              \
+
+# Use CentOS as base for the build
+ARG CENTOS_VERSION=centos7
+FROM centos:${CENTOS_VERSION} AS builder
+
+# Base directory for installed build artifacts.
+# Due to limitations of the Docker image build process, this value is
+# duplicated in an ARG in the second stage of the build.
+#
+ARG PREFIX_DIR=/usr/local/guacamole
+
+# Build arguments
+ARG BUILD_DIR=/tmp/guacd-docker-BUILD
+ARG BUILD_DEPENDENCIES="              \
         autoconf                      \
         automake                      \
         cairo-devel                   \
@@ -63,10 +52,13 @@ ENV \
         pulseaudio-libs-devel         \
         uuid-devel"
 
-# Bring environment up-to-date and install guacamole-server dependencies
+# Build time environment
+ENV LC_ALL=en_US.UTF-8
+
+# Bring build environment up to date and install build dependencies
 RUN yum -y update                        && \
     yum -y install epel-release          && \
-    yum -y install $RUNTIME_DEPENDENCIES && \
+    yum -y install $BUILD_DEPENDENCIES   && \
     yum clean all
 
 # Add configuration scripts
@@ -76,13 +68,63 @@ COPY src/guacd-docker/bin /opt/guacd/bin/
 COPY . "$BUILD_DIR"
 
 # Build guacamole-server from local source
-RUN yum -y install $BUILD_DEPENDENCIES         && \
-    /opt/guacd/bin/build-guacd.sh "$BUILD_DIR" && \
-    rm -Rf "$BUILD_DIR"                        && \
-    yum -y autoremove $BUILD_DEPENDENCIES      && \
-    yum clean all
+RUN /opt/guacd/bin/build-guacd.sh "$BUILD_DIR" "$PREFIX_DIR"
 
-# Start guacd, listening on port 0.0.0.0:4822
+# Use same CentOS as the base for the runtime image
+FROM centos:${CENTOS_VERSION}
+
+# Base directory for installed build artifacts.
+# Due to limitations of the Docker image build process, this value is
+# duplicated in an ARG in the first stage of the build. See also the
+# CMD directive at the end of this build stage.
+#
+ARG PREFIX_DIR=/usr/local/guacamole
+
+# Runtime environment
+ENV LC_ALL=en_US.UTF-8
+
+ARG RUNTIME_DEPENDENCIES="            \
+        cairo                         \
+        dejavu-sans-mono-fonts        \
+        freerdp                       \
+        freerdp-plugins               \
+        ghostscript                   \
+        libjpeg-turbo                 \
+        libssh2                       \
+        liberation-mono-fonts         \
+        libtelnet                     \
+        libvorbis                     \
+        libvncserver                  \
+        libwebp                       \
+        pango                         \
+        pulseaudio-libs               \
+        terminus-fonts                \
+        uuid"
+
+# Bring runtime environment up to date and install runtime dependencies
+RUN yum -y update                          && \
+    yum -y install epel-release            && \
+    yum -y install $RUNTIME_DEPENDENCIES   && \
+    yum clean all                          && \
+    rm -rf /var/cache/yum
+
+# Copy build artifacts into this stage
+COPY --from=builder ${PREFIX_DIR} ${PREFIX_DIR}
+
+# Link FreeRDP plugins into proper path
+RUN FREERDP_DIR=$(dirname \
+        $(rpm -ql freerdp-libs | grep 'libfreerdp.*\.so' | head -n1)) && \
+    FREERDP_PLUGIN_DIR="${FREERDP_DIR}/freerdp" && \
+    mkdir -p "$FREERDP_PLUGIN_DIR" && \
+    ln -s "$PREFIX_DIR"/lib/freerdp/*.so "$FREERDP_PLUGIN_DIR"
+
+# Expose the default listener port
 EXPOSE 4822
-CMD [ "/usr/local/sbin/guacd", "-b", "0.0.0.0", "-f" ]
+
+# Start guacd, listening on port 0.0.0.0:4822
+#
+# Note the path here MUST correspond to the value specified in the 
+# PREFIX_DIR build argument.
+#
+CMD [ "/usr/local/guacamole/sbin/guacd", "-b", "0.0.0.0", "-f" ]
 

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/e4f4761c/src/guacd-docker/bin/build-guacd.sh
----------------------------------------------------------------------
diff --git a/src/guacd-docker/bin/build-guacd.sh b/src/guacd-docker/bin/build-guacd.sh
index fe36268..9e8c3a3 100755
--- a/src/guacd-docker/bin/build-guacd.sh
+++ b/src/guacd-docker/bin/build-guacd.sh
@@ -28,16 +28,14 @@
 ##     The directory which currently contains the guacamole-server source and
 ##     in which the build should be performed.
 ##
+## @param PREFIX_DIR
+##     The directory prefix into which the build artifacts should be installed 
+##     in which the build should be performed. This is passed to the --prefix
+##     option of `configure`.
+##
 
 BUILD_DIR="$1"
-
-##
-## Locates the directory in which the FreeRDP libraries (.so files) are
-## located, printing the result to STDOUT.
-##
-where_is_freerdp() {
-    dirname `rpm -ql freerdp-libs | grep 'libfreerdp.*\.so' | head -n1`
-}
+PREFIX_DIR="$2"
 
 #
 # Build guacamole-server
@@ -45,18 +43,7 @@ where_is_freerdp() {
 
 cd "$BUILD_DIR"
 autoreconf -fi
-./configure
+./configure --prefix="$PREFIX_DIR"
 make
 make install
 ldconfig
-
-#
-# Add FreeRDP plugins to proper path
-#
-
-FREERDP_DIR=`where_is_freerdp`
-FREERDP_PLUGIN_DIR="$FREERDP_DIR/freerdp"
-
-mkdir -p "$FREERDP_PLUGIN_DIR"
-ln -s /usr/local/lib/freerdp/*.so "$FREERDP_PLUGIN_DIR"
-


[2/2] guacamole-server git commit: GUACAMOLE-456: Merge multi-stage Docker build changes.

Posted by mj...@apache.org.
GUACAMOLE-456: Merge multi-stage Docker build changes.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/0f78b01e
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/0f78b01e
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/0f78b01e

Branch: refs/heads/master
Commit: 0f78b01e8161914ab71081f7153af8ec4d664b9b
Parents: 11605ff e4f4761
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Jan 19 13:37:01 2018 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Fri Jan 19 13:37:01 2018 -0800

----------------------------------------------------------------------
 .dockerignore                       |   2 +
 Dockerfile                          | 110 +++++++++++++++++++++----------
 src/guacd-docker/bin/build-guacd.sh |  27 ++------
 3 files changed, 85 insertions(+), 54 deletions(-)
----------------------------------------------------------------------