Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions devenv/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
!devenv-init.sh
!fetch-tools.sh
!install-rust.sh
!install-uv.sh
!install-kani.sh
!devenv-selftest.sh
!userns-setup
12 changes: 10 additions & 2 deletions devenv/Containerfile.c10s
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These aren't packages, just low-dependency binaries dropped in /usr/local/bin
# so we can fetch them independently in a separate build.
ARG base=quay.io/centos/centos:stream10
FROM $base as base

Check warning on line 4 in devenv/Containerfile.c10s

View workflow job for this annotation

GitHub Actions / build (c10s, amd64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 4 in devenv/Containerfile.c10s

View workflow job for this annotation

GitHub Actions / build (c10s, arm64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
# Life is too short to care about dash
RUN ln -sfr /bin/bash /bin/sh
RUN <<EORUN
Expand All @@ -25,20 +25,25 @@
dnf -y makecache
EORUN

FROM base as tools

Check warning on line 28 in devenv/Containerfile.c10s

View workflow job for this annotation

GitHub Actions / build (c10s, amd64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 28 in devenv/Containerfile.c10s

View workflow job for this annotation

GitHub Actions / build (c10s, arm64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
# renovate: datasource=github-releases depName=bootc-dev/bcvk
ARG bcvkversion=v0.9.0
# renovate: datasource=github-releases depName=ossf/scorecard
ARG scorecardversion=v5.1.1
COPY fetch-tools.sh /run/src/
RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion /run/src/fetch-tools.sh
# renovate: datasource=github-releases depName=nushell/nushell
ARG nushellversion=0.110.0
# renovate: datasource=github-releases depName=astral-sh/uv
ARG uvversion=0.10.2
COPY fetch-tools.sh install-uv.sh /run/src/
RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion nushellversion=$nushellversion /run/src/fetch-tools.sh
Comment thread
cgwalters marked this conversation as resolved.
RUN uvversion=$uvversion /run/src/install-uv.sh

FROM base as rust

Check warning on line 41 in devenv/Containerfile.c10s

View workflow job for this annotation

GitHub Actions / build (c10s, amd64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 41 in devenv/Containerfile.c10s

View workflow job for this annotation

GitHub Actions / build (c10s, arm64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
COPY install-rust.sh /run/src/
RUN /run/src/install-rust.sh

# Kani formal verification tool - requires rustup for toolchain management
FROM rust as kani

Check warning on line 46 in devenv/Containerfile.c10s

View workflow job for this annotation

GitHub Actions / build (c10s, amd64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 46 in devenv/Containerfile.c10s

View workflow job for this annotation

GitHub Actions / build (c10s, arm64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
# renovate: datasource=crate depName=kani-verifier
ARG kaniversion=0.67.0
RUN dnf install -y gcc && dnf clean all
Expand Down Expand Up @@ -73,6 +78,9 @@
ENV RUSTUP_HOME=/usr/local/rustup
# Point Kani at the system-wide installation
ENV KANI_HOME=/usr/local/kani
# Configure uv for system-wide tool installation
ENV UV_TOOL_DIR=/usr/local/uv-tools
ENV UV_TOOL_BIN_DIR=/usr/local/bin
# Setup for codespaces
COPY devenv-init.sh /usr/local/bin/
COPY userns-setup /usr/lib/devenv/userns-setup
Expand Down
20 changes: 18 additions & 2 deletions devenv/Containerfile.debian
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# These aren't packages, just low-dependency binaries dropped in /usr/local/bin
# so we can fetch them independently in a separate build.
ARG base=docker.io/library/debian:sid
FROM $base as base

Check warning on line 4 in devenv/Containerfile.debian

View workflow job for this annotation

GitHub Actions / build (debian, arm64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 4 in devenv/Containerfile.debian

View workflow job for this annotation

GitHub Actions / build (debian, amd64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
# Life is too short to care about dash
RUN ln -sfr /bin/bash /bin/sh
RUN <<EORUN
set -xeuo pipefail

# Disable apt sandboxing for nested container environments
echo 'APT::Sandbox::User "root";' > /etc/apt/apt.conf.d/99sandbox-disable

# Initialize some basic packages
apt -y update && apt -y install curl time bzip2

Expand All @@ -25,20 +28,25 @@
apt -y update
EORUN

FROM base as tools

Check warning on line 31 in devenv/Containerfile.debian

View workflow job for this annotation

GitHub Actions / build (debian, arm64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 31 in devenv/Containerfile.debian

View workflow job for this annotation

GitHub Actions / build (debian, amd64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
# renovate: datasource=github-releases depName=bootc-dev/bcvk
ARG bcvkversion=v0.9.0
# renovate: datasource=github-releases depName=ossf/scorecard
ARG scorecardversion=v5.1.1
COPY fetch-tools.sh /run/src/
RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion /run/src/fetch-tools.sh
# renovate: datasource=github-releases depName=nushell/nushell
ARG nushellversion=0.110.0
# renovate: datasource=github-releases depName=astral-sh/uv
ARG uvversion=0.10.2
COPY fetch-tools.sh install-uv.sh /run/src/
RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion nushellversion=$nushellversion /run/src/fetch-tools.sh
Comment thread
cgwalters marked this conversation as resolved.
RUN uvversion=$uvversion /run/src/install-uv.sh

FROM base as rust

Check warning on line 44 in devenv/Containerfile.debian

View workflow job for this annotation

GitHub Actions / build (debian, arm64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 44 in devenv/Containerfile.debian

View workflow job for this annotation

GitHub Actions / build (debian, amd64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
COPY install-rust.sh /run/src/
RUN /run/src/install-rust.sh

# Kani formal verification tool - requires rustup for toolchain management
FROM rust as kani

Check warning on line 49 in devenv/Containerfile.debian

View workflow job for this annotation

GitHub Actions / build (debian, arm64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 49 in devenv/Containerfile.debian

View workflow job for this annotation

GitHub Actions / build (debian, amd64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
# renovate: datasource=crate depName=kani-verifier
ARG kaniversion=0.67.0
RUN apt-get update && apt-get install -y --no-install-recommends gcc libc6-dev && rm -rf /var/lib/apt/lists/*
Expand All @@ -59,6 +67,14 @@
COPY npm.txt /run/src
RUN grep -vEe '^#' npm.txt | /bin/time -f '%E %C' xargs npm i -g

# Install tmt via uv tool install for isolated environment
# UV_TOOL_DIR and UV_TOOL_BIN_DIR set to system-wide locations like rustup
COPY --from=tools /usr/local/bin/uv /usr/local/bin/uv
COPY --from=tools /usr/local/bin/uvx /usr/local/bin/uvx
ENV UV_TOOL_DIR=/usr/local/uv-tools
ENV UV_TOOL_BIN_DIR=/usr/local/bin
RUN uv tool install 'tmt[provision-virtual]'

# Copy in the binaries from our tools container image
COPY --from=tools /usr/local/bin/* /usr/local/bin/
COPY --from=kani /usr/local/bin/* /usr/local/bin/
Expand Down
12 changes: 10 additions & 2 deletions devenv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ This container image is suitable for use on
developing projects in the bootc-dev organization,
especially bootc.

It includes all tools used in the Justfile
for relevant projects.
The goal is to make this completely usable as a devcontainer
with tools such as VSCode remote containers, Codespaces,
[devpod](https://devpod.sh/) and others.

Specifically this includes e.g.:

- Rust and C/C++ toolchains
- `nu`
- [tmt](https://tmt.readthedocs.io/)
- [Kani](https://model-checking.github.io/kani/usage.html) for system verification

## Base image

Expand Down
7 changes: 5 additions & 2 deletions devenv/devenv-init.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash
# Thin wrapper that calls the Python implementation
exec python3 /usr/lib/devenv/userns-setup "$@"
# Initialize development environment
set -euo pipefail

# Set up podman for nested containers
python3 /usr/lib/devenv/userns-setup "$@"
20 changes: 20 additions & 0 deletions devenv/fetch-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -xeuo pipefail
# Required environment variables (passed as build ARGs)
: "${bcvkversion:?bcvkversion is required}"
: "${scorecardversion:?scorecardversion is required}"
: "${nushellversion:?nushellversion is required}"

arch=$(arch)

Expand Down Expand Up @@ -42,3 +43,22 @@ td=$(mktemp -d)
mv scorecard /usr/local/bin/scorecard
)
rm -rf $td

# nushell - modern shell
td=$(mktemp -d)
(
cd $td
# Map arch to nushell naming convention
case "${arch}" in
x86_64) nuarch=x86_64 ;;
aarch64) nuarch=aarch64 ;;
*) echo "nushell unavailable for $arch"; return 0 ;;
esac
target=nu-${nushellversion}-${nuarch}-unknown-linux-gnu.tar.gz
/bin/time -f '%E %C' curl -fLO https://github.com/nushell/nushell/releases/download/$nushellversion/$target
Comment thread
cgwalters marked this conversation as resolved.
tar xvzf $target
Comment thread
cgwalters marked this conversation as resolved.
# The extracted directory has the same name as the archive without .tar.gz
extracted_dir=nu-${nushellversion}-${nuarch}-unknown-linux-gnu
mv $extracted_dir/nu /usr/local/bin/nu
Comment thread
cgwalters marked this conversation as resolved.
)
rm -rf $td
34 changes: 34 additions & 0 deletions devenv/install-uv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# Install uv system-wide into /usr/local
# This script is shared between c10s and debian container builds.
# Similar to rustup, we install the binary to /usr/local/bin and configure
# tools to be installed system-wide via environment variables.
set -xeuo pipefail

: "${uvversion:?uvversion is required}"

arch=$(arch)

# Map arch to uv naming convention
case "${arch}" in
x86_64) uvarch=x86_64 ;;
aarch64) uvarch=aarch64 ;;
*) echo "uv unavailable for $arch"; exit 1 ;;
esac

target=uv-${uvarch}-unknown-linux-gnu.tar.gz

td=$(mktemp -d)
(
cd $td
/bin/time -f '%E %C' curl -fLO https://github.com/astral-sh/uv/releases/download/${uvversion}/$target
tar xvzf $target
# The extracted directory has the same name as the archive without .tar.gz
extracted_dir=uv-${uvarch}-unknown-linux-gnu
mv $extracted_dir/uv /usr/local/bin/uv
mv $extracted_dir/uvx /usr/local/bin/uvx
)
rm -rf $td

# Verify installation
/usr/local/bin/uv --version
3 changes: 3 additions & 0 deletions devenv/packages-c10s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ xorriso
qemu-img
libvirt-daemon-kvm

# Testing framework
tmt

# TUI editors
vim-enhanced
3 changes: 3 additions & 0 deletions devenv/packages-debian.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ libkrb5-dev
libvirt-dev
libostree-dev

# Python dev headers (needed for uv to build libvirt-python from source for tmt)
python3-dev

# Runtime virt
genisoimage
qemu-utils
Expand Down