| 1 | # syntax=docker/dockerfile:1 |
| 2 | # raz currently targets x86-64 Linux only; build with --platform linux/amd64. |
| 3 | FROM debian:12-slim@sha256:a4672c0cb26fbdde88e38fa2dfb6c681942306680e41e4378b28770b6e79ee91 AS base |
| 4 | |
| 5 | # Optional combined CA bundle for builds behind a TLS-inspecting proxy. It is |
| 6 | # mounted only for networked steps and never becomes part of the image. |
| 7 | RUN --mount=type=secret,id=proxy_ca \ |
| 8 | test "$(dpkg --print-architecture)" = amd64 && \ |
| 9 | if [ -f /run/secrets/proxy_ca ]; then \ |
| 10 | printf 'Acquire::https::CaInfo "/run/secrets/proxy_ca";\n' > /etc/apt/apt.conf.d/99-build-ca; \ |
| 11 | fi && \ |
| 12 | apt-get update && \ |
| 13 | DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 14 | bash ca-certificates curl git && \ |
| 15 | rm -rf /var/lib/apt/lists/* /etc/apt/apt.conf.d/99-build-ca |
| 16 | |
| 17 | # Keep each compressed layer below Cloudflare's free-plan upload limit. |
| 18 | RUN --mount=type=secret,id=proxy_ca \ |
| 19 | if [ -f /run/secrets/proxy_ca ]; then \ |
| 20 | printf 'Acquire::https::CaInfo "/run/secrets/proxy_ca";\n' > /etc/apt/apt.conf.d/99-build-ca; \ |
| 21 | fi && \ |
| 22 | apt-get update && \ |
| 23 | DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 24 | build-essential pkg-config && \ |
| 25 | rm -rf /var/lib/apt/lists/* /etc/apt/apt.conf.d/99-build-ca |
| 26 | |
| 27 | RUN --mount=type=secret,id=proxy_ca \ |
| 28 | if [ -f /run/secrets/proxy_ca ]; then \ |
| 29 | printf 'Acquire::https::CaInfo "/run/secrets/proxy_ca";\n' > /etc/apt/apt.conf.d/99-build-ca; \ |
| 30 | fi && \ |
| 31 | apt-get update && \ |
| 32 | DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 33 | bsdextrautils groff procps python3 tzdata && \ |
| 34 | rm -rf /var/lib/apt/lists/* /etc/apt/apt.conf.d/99-build-ca |
| 35 | |
| 36 | FROM base AS build |
| 37 | COPY build-tools.sh /tmp/build-tools.sh |
| 38 | RUN --mount=type=secret,id=proxy_ca \ |
| 39 | if [ -f /run/secrets/proxy_ca ]; then \ |
| 40 | export CURL_CA_BUNDLE=/run/secrets/proxy_ca GIT_SSL_CAINFO=/run/secrets/proxy_ca; \ |
| 41 | fi; \ |
| 42 | sh /tmp/build-tools.sh |
| 43 | |
| 44 | FROM base AS ci |
| 45 | LABEL org.opencontainers.image.title="raz CI" \ |
| 46 | org.opencontainers.image.description="raz 0.21.0 with concha, robbie and native build tools" \ |
| 47 | org.opencontainers.image.source="https://github.com/ldiaz94/raz" \ |
| 48 | org.opencontainers.image.version="0.21.0-debian12-r1" |
| 49 | COPY --from=build /opt/raz /opt/raz |
| 50 | COPY --from=build /usr/local/ /usr/local/ |
| 51 | COPY --chmod=0644 smoke.sh /usr/local/share/raz-ci/smoke.sh |
| 52 | RUN ln -s /opt/raz/raz /usr/local/bin/raz && \ |
| 53 | sh /usr/local/share/raz-ci/smoke.sh |
| 54 | WORKDIR /workspace |
| 55 | CMD ["bash"] |