build-cran-binaries/docker/build-one.Dockerfile
pat-s 435108c30e
feat(local): just rebuild recipe for targeted package builds via remote buildx
Adds a `just rebuild <os> <tag> <arch> <package> <version>...` recipe that
dispatches a single-package (re)build to a remote buildx builder (artemis=amd64,
gaia=arm64). build-one.R auto-classifies each version (per-minor slot for risky,
generic otherwise), force-rebuilds + uploads, and refreshes the touched index.
2026-06-14 10:59:51 +02:00

32 lines
1.5 KiB
Docker

# syntax=docker/dockerfile:1
# Targeted (re)build of specific package versions, executed on a remote buildx
# builder. The build's effect is the S3 upload performed by build-one.R; no
# image is kept (the justfile uses --output type=cacheonly). CACHEBUST forces
# the RUN to re-execute on every invocation.
#
# Build context is `local/` (see the `rebuild` recipe in the justfile).
ARG OS
ARG OS_VERSION
FROM reg.devxy.io/rpkgs/build-env-${OS}:${OS_VERSION}
ARG R_VERSION=4.5.3
ARG PACKAGE
ARG VERSIONS
ARG CACHEBUST
WORKDIR /work
COPY build-one.R /work/build-one.R
RUN --mount=type=secret,id=b2_access,required=true \
--mount=type=secret,id=b2_secret,required=true \
--mount=type=secret,id=pgpass,required=true \
--mount=type=secret,id=github_pat,required=false \
export B2_S3_ACCESS_KEY="$(cat /run/secrets/b2_access)" && \
export B2_S3_SECRET_KEY="$(cat /run/secrets/b2_secret)" && \
export PGPASS="$(cat /run/secrets/pgpass)" && \
export GITHUB_PAT="$(cat /run/secrets/github_pat 2>/dev/null || true)" && \
/opt/R/${R_VERSION}/bin/R -q -e 'if (!requireNamespace("bincraft", quietly = TRUE) || packageVersion("bincraft") != "4.2.0") pak::pak("git::https://codefloe.com/rpkgs/bincraft.git@v4.2.0")' && \
XVFB=$(command -v xwfb-run 2>/dev/null || command -v xvfb-run); \
XVFB_ARGS=""; \
if command -v xwfb-run >/dev/null 2>&1; then dnf install -y -q weston 2>/dev/null; XVFB_ARGS="-c weston"; fi; \
$XVFB $XVFB_ARGS -- /opt/R/${R_VERSION}/bin/Rscript /work/build-one.R "${PACKAGE}" ${VERSIONS}