raz / containers / ci / Dockerfile

55 lines · 2.4 KiB · raw · history · last change 4c98ab55

1# syntax=docker/dockerfile:1
2# raz currently targets x86-64 Linux only; build with --platform linux/amd64.
3FROM 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.
7RUN --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.
18RUN --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
27RUN --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
36FROM base AS build
37COPY build-tools.sh /tmp/build-tools.sh
38RUN --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
44FROM base AS ci
45LABEL 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"
49COPY --from=build /opt/raz /opt/raz
50COPY --from=build /usr/local/ /usr/local/
51COPY --chmod=0644 smoke.sh /usr/local/share/raz-ci/smoke.sh
52RUN ln -s /opt/raz/raz /usr/local/bin/raz && \
53 sh /usr/local/share/raz-ci/smoke.sh
54WORKDIR /workspace
55CMD ["bash"]