| 1 |
# The OxygenFlow build image (backlog F1b): Rust with rustfmt and clippy, |
| 2 |
# Node, every crate the Oxygen projects use, vendored, and an npm cache for |
| 3 |
# the Oxygen extensions, because jobs |
| 4 |
# have no network. Built by ./build.sh, which vendors the crates first. |
| 5 |
FROM rust:1.97.1-slim-bookworm |
| 6 |
|
| 7 |
RUN rustup component add rustfmt clippy \ |
| 8 |
&& apt-get update \ |
| 9 |
&& apt-get install -y --no-install-recommends ca-certificates xz-utils make git pkg-config \ |
| 10 |
&& rm -rf /var/lib/apt/lists/* |
| 11 |
|
| 12 |
# The guest's PATH is fixed and has no /usr/local/cargo/bin, and a rustup |
| 13 |
# proxy would need RUSTUP_HOME: link the toolchain's own binaries instead. |
| 14 |
RUN tc=$(ls -d /usr/local/rustup/toolchains/*/ | head -1) \ |
| 15 |
&& for b in cargo rustc rustdoc cargo-fmt rustfmt cargo-clippy clippy-driver; do ln -sf "$tc/bin/$b" /usr/local/bin/$b; done |
| 16 |
|
| 17 |
ARG NODE_VERSION |
| 18 |
ARG NODE_SHA256 |
| 19 |
ADD https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz /tmp/node.tar.xz |
| 20 |
RUN echo "${NODE_SHA256} /tmp/node.tar.xz" | sha256sum -c - \ |
| 21 |
&& tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 --exclude='*/include' --exclude='*/share/doc' \ |
| 22 |
&& rm /tmp/node.tar.xz |
| 23 |
|
| 24 |
# PostgreSQL (oxygenhub#211): OxygenHub's tests on Postgres start a server |
| 25 |
# of their own on loopback inside the job (.flow/test-postgres.sh). Debian's |
| 26 |
# server, its programs linked onto the guest's fixed PATH, and nss_wrapper: |
| 27 |
# a job runs as the runner's builder, a user this image's /etc/passwd does |
| 28 |
# not name, and initdb must look its user up. |
| 29 |
RUN apt-get update \ |
| 30 |
&& apt-get install -y --no-install-recommends postgresql libnss-wrapper \ |
| 31 |
&& rm -rf /var/lib/apt/lists/* \ |
| 32 |
&& for b in initdb pg_ctl postgres; do ln -sf /usr/lib/postgresql/*/bin/$b /usr/local/bin/$b; done \ |
| 33 |
&& initdb --version |
| 34 |
|
| 35 |
# npm's cache for the Oxygen extensions' lock files: `npm ci --offline |
| 36 |
# --cache /opt/npm-cache` installs from it, read-only as it is. |
| 37 |
COPY npm-cache /opt/npm-cache |
| 38 |
|
| 39 |
# Cargo reads /.cargo/config.toml for anything under /, so /src uses the |
| 40 |
# vendored crates; CARGO_HOME stays the default $HOME/.cargo (/tmp). |
| 41 |
COPY vendor /opt/vendor |
| 42 |
COPY cargo-config.toml /.cargo/config.toml |