Manually compile YAD to reduce image size.

This commit is contained in:
Jocelyn Le Sage 2021-01-04 17:27:36 -05:00
parent 43569e4414
commit 0fd331a5a0

View File

@ -20,11 +20,13 @@ ARG DOCKER_IMAGE_VERSION=unknown
# Define software versions. # Define software versions.
ARG FIREFOX_VERSION=83.0-r1 ARG FIREFOX_VERSION=83.0-r1
ARG YAD_VERSION=7.3
ARG JSONLZ4_VERSION=c4305b8 ARG JSONLZ4_VERSION=c4305b8
ARG LZ4_VERSION=1.8.1.2 ARG LZ4_VERSION=1.8.1.2
#ARG PROFILE_CLEANER_VERSION=2.36 #ARG PROFILE_CLEANER_VERSION=2.36
# Define software download URLs. # 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 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 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 #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} # --upgrade firefox=${FIREFOX_VERSION}
add-pkg 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. # Install extra packages.
RUN \ RUN \
add-pkg \ add-pkg \
@ -100,7 +137,6 @@ RUN \
# Enable log monitoring. # Enable log monitoring.
RUN \ RUN \
add-pkg yad && \
sed-patch 's|LOG_FILES=|LOG_FILES=/config/log/firefox/error.log|' /etc/logmonitor/logmonitor.conf && \ 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 sed-patch 's|STATUS_FILES=|STATUS_FILES=/tmp/.firefox_shm_check,/tmp/.firefox_membarrier_check|' /etc/logmonitor/logmonitor.conf