The Alpine builder images install R-dev but never the graphics headers.
R's configure treats those as optional and does not fail when they are
absent, so the build succeeds and ships an R whose capabilities() reports
cairo, png, jpeg and tiff as FALSE. Installing the runtime libraries on
the target system afterwards cannot bring compiled-out devices back.
Note that --with-x=no was not the cause. R's bitmap and pangocairo checks
run independently of R_X11, and libpng was in fact found. capabilities("png")
needs a device backend, and with X11 off and cairo absent there was none,
which is why all four read FALSE. X11 stays off: these are headless images
and cairo covers png()/jpeg()/tiff()/svg().
- Install pkgconf, cairo-dev, pango-dev, fontconfig-dev, freetype-dev,
libpng-dev, jpeg-dev, tiff-dev and zlib-dev in every Alpine builder image.
- Pass --with-cairo, --with-libpng, --with-jpeglib and --with-libtiff
explicitly so the intent is visible next to --with-x=no.
- Assert REQUIRED_CAPABILITIES after make install, so a build that loses a
device fails instead of being packaged and uploaded. Opt-in per Dockerfile,
leaving the other platforms untouched.
- Add a FORCE_REBUILD escape hatch to the dedup step. Artifact filenames
carry only the R version, so the HEAD probe would otherwise keep skipping
every Alpine version and serving the stale broken binaries.
- Record the three gotchas in CLAUDE.md.
Verified by compiling R 4.5.1 in the patched alpine-322 image: jpeg, png,
tiff and cairo are TRUE, default bitmapType is cairo, and all four devices
render. The guard was exercised in both directions against that build.
38 lines
1.8 KiB
Text
38 lines
1.8 KiB
Text
FROM reg.devxy.io/docker.io/library/alpine:3.24
|
|
|
|
ENV OS_IDENTIFIER alpine-324
|
|
|
|
RUN set -x \
|
|
&& apk add -q R-dev curl ca-certificates bash g++ tzdata openjdk17 texmf-dist texlive-full tar sed patch tcl tk tk-dev xvfb libdeflate libdeflate-dev
|
|
|
|
# Graphics devices. R's configure only enables the cairo/png/jpeg/tiff devices
|
|
# when the corresponding headers are present at compile time, and pkgconf must
|
|
# exist for the pangocairo check to run at all. Without these, capabilities()
|
|
# reports cairo/png/jpeg/tiff as FALSE, and installing the runtime libraries
|
|
# afterwards cannot bring the compiled-out devices back.
|
|
RUN apk add -q pkgconf cairo-dev pango-dev fontconfig-dev freetype-dev libpng-dev jpeg-dev tiff-dev zlib-dev
|
|
|
|
# Install s5cmd for S3 uploads (much faster than AWS CLI)
|
|
RUN ARCH=$(uname -m); if [ "$ARCH" = "x86_64" ]; then S5CMD_ARCH="64bit"; else S5CMD_ARCH="arm64"; fi && \
|
|
curl -sL "https://github.com/peak/s5cmd/releases/download/v2.3.0/s5cmd_2.3.0_Linux-${S5CMD_ARCH}.tar.gz" | tar xz -C /usr/local/bin s5cmd
|
|
|
|
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.39.0/nfpm_2.39.0_$(arch).apk" && \
|
|
apk add --allow-untrusted "./nfpm_2.39.0_$(arch).apk" && \
|
|
rm "nfpm_2.39.0_$(arch).apk"
|
|
|
|
RUN chmod 0777 /opt
|
|
|
|
# Override the default pager used by R
|
|
ENV PAGER /usr/bin/pager
|
|
|
|
# X11 stays off: these are headless images, and the cairo/bitmap devices are
|
|
# detected independently of X11, so png()/svg() still work via cairo.
|
|
ENV CONFIGURE_OPTIONS "--enable-R-shlib --with-tcltk --enable-memory-profiling --with-x=no --with-cairo --with-libpng --with-jpeglib --with-libtiff --with-blas --with-lapack"
|
|
|
|
# Fail the build if a graphics device silently drops out again.
|
|
ENV REQUIRED_CAPABILITIES "cairo,png,jpeg,tiff"
|
|
|
|
COPY package.alpine-324 /package.sh
|
|
COPY build.sh .
|
|
COPY patches /patches
|
|
ENTRYPOINT ./build.sh
|