From 0fd331a5a00170d2e57002a2abc7f8644a53b725 Mon Sep 17 00:00:00 2001 From: Jocelyn Le Sage Date: Mon, 4 Jan 2021 17:27:36 -0500 Subject: [PATCH] Manually compile YAD to reduce image size. --- Dockerfile | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 66a2ec5..c3925a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,11 +20,13 @@ ARG DOCKER_IMAGE_VERSION=unknown # Define software versions. ARG FIREFOX_VERSION=83.0-r1 +ARG YAD_VERSION=7.3 ARG JSONLZ4_VERSION=c4305b8 ARG LZ4_VERSION=1.8.1.2 #ARG PROFILE_CLEANER_VERSION=2.36 # Define software download URLs. +ARG YAD_URL=https://github.com/v1cont/yad/archive/v${YAD_VERSION}.tar.gz ARG JSONLZ4_URL=https://github.com/avih/dejsonlz4/archive/${JSONLZ4_VERSION}.tar.gz ARG LZ4_URL=https://github.com/lz4/lz4/archive/v${LZ4_VERSION}.tar.gz #ARG PROFILE_CLEANER_URL=https://github.com/graysky2/profile-cleaner/raw/v${PROFILE_CLEANER_VERSION}/common/profile-cleaner.in @@ -62,6 +64,41 @@ RUN \ # --upgrade firefox=${FIREFOX_VERSION} add-pkg firefox=${FIREFOX_VERSION} +# Install YAD. +# NOTE: YAD is compiled manually because the version on the Alpine repository +# pulls too much dependencies. +RUN \ + # Install packages needed by the build. + add-pkg --virtual build-dependencies \ + build-base \ + autoconf \ + automake \ + intltool \ + curl \ + gtk+3.0-dev \ + && \ + # Set same default compilation flags as abuild. + export CFLAGS="-Os -fomit-frame-pointer" && \ + export CXXFLAGS="$CFLAGS" && \ + export CPPFLAGS="$CFLAGS" && \ + export LDFLAGS="-Wl,--as-needed" && \ + # Download. + mkdir yad && \ + echo "Downloading YAD package..." && \ + curl -# -L ${YAD_URL} | tar xz --strip 1 -C yad && \ + # Compile. + cd yad && \ + autoreconf -ivf && intltoolize && \ + ./configure \ + --prefix=/usr \ + && \ + make && make install && \ + strip /usr/bin/yad && \ + cd .. && \ + # Cleanup. + del-pkg build-dependencies && \ + rm -rf /tmp/* /tmp/.[!.]* + # Install extra packages. RUN \ add-pkg \ @@ -100,7 +137,6 @@ RUN \ # Enable log monitoring. RUN \ - add-pkg yad && \ sed-patch 's|LOG_FILES=|LOG_FILES=/config/log/firefox/error.log|' /etc/logmonitor/logmonitor.conf && \ sed-patch 's|STATUS_FILES=|STATUS_FILES=/tmp/.firefox_shm_check,/tmp/.firefox_membarrier_check|' /etc/logmonitor/logmonitor.conf