cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

Dockerfile (6018B)


      1#
      2# Licensed to the Apache Software Foundation (ASF) under one
      3# or more contributor license agreements.  See the NOTICE file
      4# distributed with this work for additional information
      5# regarding copyright ownership.  The ASF licenses this file
      6# to you under the Apache License, Version 2.0 (the
      7# "License"); you may not use this file except in compliance
      8# with the License.  You may obtain a copy of the License at
      9#
     10#   http://www.apache.org/licenses/LICENSE-2.0
     11#
     12# Unless required by applicable law or agreed to in writing,
     13# software distributed under the License is distributed on an
     14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     15# KIND, either express or implied.  See the License for the
     16# specific language governing permissions and limitations
     17# under the License.
     18#
     19
     20#
     21# Dockerfile for guacamole-server
     22#
     23
     24# The Alpine Linux image that should be used as the basis for the guacd image
     25ARG ALPINE_BASE_IMAGE=latest
     26FROM alpine:${ALPINE_BASE_IMAGE} AS builder
     27
     28# Install build dependencies
     29RUN apk add --no-cache                \
     30        autoconf                      \
     31        automake                      \
     32        build-base                    \
     33        cairo-dev                     \
     34        cmake                         \
     35        git                           \
     36        grep                          \
     37        libjpeg-turbo-dev             \
     38        libpng-dev                    \
     39        libtool                       \
     40        libwebp-dev                   \
     41        make                          \
     42        openssl1.1-compat-dev         \
     43        pango-dev                     \
     44        pulseaudio-dev                \
     45        util-linux-dev
     46
     47# Copy source to container for sake of build
     48ARG BUILD_DIR=/tmp/guacamole-server
     49COPY . ${BUILD_DIR}
     50
     51#
     52# Base directory for installed build artifacts.
     53#
     54# NOTE: Due to limitations of the Docker image build process, this value is
     55# duplicated in an ARG in the second stage of the build.
     56#
     57ARG PREFIX_DIR=/opt/guacamole
     58
     59#
     60# Automatically select the latest versions of each core protocol support
     61# library (these can be overridden at build time if a specific version is
     62# needed)
     63#
     64ARG WITH_FREERDP='2(\.\d+)+'
     65ARG WITH_LIBSSH2='libssh2-\d+(\.\d+)+'
     66ARG WITH_LIBTELNET='\d+(\.\d+)+'
     67ARG WITH_LIBVNCCLIENT='LibVNCServer-\d+(\.\d+)+'
     68ARG WITH_LIBWEBSOCKETS='v\d+(\.\d+)+'
     69
     70#
     71# Default build options for each core protocol support library, as well as
     72# guacamole-server itself (these can be overridden at build time if different
     73# options are needed)
     74#
     75
     76ARG FREERDP_OPTS="\
     77    -DBUILTIN_CHANNELS=OFF \
     78    -DCHANNEL_URBDRC=OFF \
     79    -DWITH_ALSA=OFF \
     80    -DWITH_CAIRO=ON \
     81    -DWITH_CHANNELS=ON \
     82    -DWITH_CLIENT=ON \
     83    -DWITH_CUPS=OFF \
     84    -DWITH_DIRECTFB=OFF \
     85    -DWITH_FFMPEG=OFF \
     86    -DWITH_GSM=OFF \
     87    -DWITH_GSSAPI=OFF \
     88    -DWITH_IPP=OFF \
     89    -DWITH_JPEG=ON \
     90    -DWITH_LIBSYSTEMD=OFF \
     91    -DWITH_MANPAGES=OFF \
     92    -DWITH_OPENH264=OFF \
     93    -DWITH_OPENSSL=ON \
     94    -DWITH_OSS=OFF \
     95    -DWITH_PCSC=OFF \
     96    -DWITH_PULSE=OFF \
     97    -DWITH_SERVER=OFF \
     98    -DWITH_SERVER_INTERFACE=OFF \
     99    -DWITH_SHADOW_MAC=OFF \
    100    -DWITH_SHADOW_X11=OFF \
    101    -DWITH_SSE2=ON \
    102    -DWITH_WAYLAND=OFF \
    103    -DWITH_X11=OFF \
    104    -DWITH_X264=OFF \
    105    -DWITH_XCURSOR=ON \
    106    -DWITH_XEXT=ON \
    107    -DWITH_XI=OFF \
    108    -DWITH_XINERAMA=OFF \
    109    -DWITH_XKBFILE=ON \
    110    -DWITH_XRENDER=OFF \
    111    -DWITH_XTEST=OFF \
    112    -DWITH_XV=OFF \
    113    -DWITH_ZLIB=ON"
    114
    115ARG GUACAMOLE_SERVER_OPTS="\
    116    --disable-guaclog"
    117
    118ARG LIBSSH2_OPTS="\
    119    -DBUILD_EXAMPLES=OFF \
    120    -DBUILD_SHARED_LIBS=ON"
    121
    122ARG LIBTELNET_OPTS="\
    123    --disable-static \
    124    --disable-util"
    125
    126ARG LIBVNCCLIENT_OPTS=""
    127
    128ARG LIBWEBSOCKETS_OPTS="\
    129    -DDISABLE_WERROR=ON \
    130    -DLWS_WITHOUT_SERVER=ON \
    131    -DLWS_WITHOUT_TESTAPPS=ON \
    132    -DLWS_WITHOUT_TEST_CLIENT=ON \
    133    -DLWS_WITHOUT_TEST_PING=ON \
    134    -DLWS_WITHOUT_TEST_SERVER=ON \
    135    -DLWS_WITHOUT_TEST_SERVER_EXTPOLL=ON \
    136    -DLWS_WITH_STATIC=OFF"
    137
    138# Build guacamole-server and its core protocol library dependencies
    139RUN ${BUILD_DIR}/src/guacd-docker/bin/build-all.sh
    140
    141# Record the packages of all runtime library dependencies
    142RUN ${BUILD_DIR}/src/guacd-docker/bin/list-dependencies.sh \
    143        ${PREFIX_DIR}/sbin/guacd               \
    144        ${PREFIX_DIR}/lib/libguac-client-*.so  \
    145        ${PREFIX_DIR}/lib/freerdp2/*guac*.so   \
    146        > ${PREFIX_DIR}/DEPENDENCIES
    147
    148# Use same Alpine version as the base for the runtime image
    149FROM alpine:${ALPINE_BASE_IMAGE}
    150
    151#
    152# Base directory for installed build artifacts. See also the
    153# CMD directive at the end of this build stage.
    154#
    155# NOTE: Due to limitations of the Docker image build process, this value is
    156# duplicated in an ARG in the first stage of the build.
    157#
    158ARG PREFIX_DIR=/opt/guacamole
    159
    160# Runtime environment
    161ENV LC_ALL=C.UTF-8
    162ENV LD_LIBRARY_PATH=${PREFIX_DIR}/lib
    163ENV GUACD_LOG_LEVEL=info
    164
    165# Copy build artifacts into this stage
    166COPY --from=builder ${PREFIX_DIR} ${PREFIX_DIR}
    167
    168# Bring runtime environment up to date and install runtime dependencies
    169RUN apk add --no-cache                \
    170        ca-certificates               \
    171        ghostscript                   \
    172        netcat-openbsd                \
    173        shadow                        \
    174        terminus-font                 \
    175        ttf-dejavu                    \
    176        ttf-liberation                \
    177        util-linux-login && \
    178    xargs apk add --no-cache < ${PREFIX_DIR}/DEPENDENCIES
    179
    180# Checks the operating status every 5 minutes with a timeout of 5 seconds
    181HEALTHCHECK --interval=5m --timeout=5s CMD nc -z 127.0.0.1 4822 || exit 1
    182
    183# Create a new user guacd
    184ARG UID=1000
    185ARG GID=1000
    186RUN groupadd --gid $GID guacd
    187RUN useradd --system --create-home --shell /sbin/nologin --uid $UID --gid $GID guacd
    188
    189# Run with user guacd
    190USER guacd
    191
    192# Expose the default listener port
    193EXPOSE 4822
    194
    195# Start guacd, listening on port 0.0.0.0:4822
    196#
    197# Note the path here MUST correspond to the value specified in the 
    198# PREFIX_DIR build argument.
    199#
    200CMD /opt/guacamole/sbin/guacd -b 0.0.0.0 -L $GUACD_LOG_LEVEL -f
    201