-
Notifications
You must be signed in to change notification settings - Fork 5
devenv: Add Ubuntu 24.04 based devenv image #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "name": "bootc-devenv-debian", | ||
| "image": "ghcr.io/bootc-dev/devenv-debian", | ||
| "customizations": { | ||
| "vscode": { | ||
| // Arbitrary, but most of our code is in one of these two | ||
| "extensions": [ | ||
| "rust-lang.rust-analyzer", | ||
| "golang.Go" | ||
| ] | ||
| }, | ||
| "devaipod": { | ||
| // When running under devaipod, use minimal capabilities | ||
| // (SYS_ADMIN, NET_ADMIN, etc.) instead of full --privileged. | ||
| "nestedContainers": true | ||
| } | ||
| }, | ||
| "features": {}, | ||
| // Use privileged mode for broad compatibility (Codespaces, Docker, | ||
| // stock devcontainer CLI). devaipod overrides this with tighter | ||
| // security via the nestedContainers customization above. | ||
| "privileged": true, | ||
| "postCreateCommand": { | ||
| // Our init script | ||
| "devenv-init": "sudo /usr/local/bin/devenv-init.sh" | ||
| }, | ||
| "remoteEnv": { | ||
| "PATH": "${containerEnv:PATH}:/usr/local/cargo/bin" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "name": "bootc-devenv-ubuntu", | ||
| "image": "ghcr.io/bootc-dev/devenv-ubuntu", | ||
| "customizations": { | ||
| "vscode": { | ||
| // Arbitrary, but most of our code is in one of these two | ||
| "extensions": [ | ||
| "rust-lang.rust-analyzer", | ||
| "golang.Go" | ||
| ] | ||
| }, | ||
| "devaipod": { | ||
| // When running under devaipod, use minimal capabilities | ||
| // (SYS_ADMIN, NET_ADMIN, etc.) instead of full --privileged. | ||
| "nestedContainers": true | ||
| } | ||
| }, | ||
| "features": {}, | ||
| // Use privileged mode for broad compatibility (Codespaces, Docker, | ||
| // stock devcontainer CLI). devaipod overrides this with tighter | ||
| // security via the nestedContainers customization above. | ||
| "privileged": true, | ||
| "postCreateCommand": { | ||
| // Our init script | ||
| "devenv-init": "sudo /usr/local/bin/devenv-init.sh" | ||
| }, | ||
| "remoteEnv": { | ||
| "PATH": "${containerEnv:PATH}:/usr/local/cargo/bin" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| # 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/ubuntu:24.04 | ||
| FROM $base AS base | ||
| # 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 ca-certificates curl time bzip2 software-properties-common | ||
|
|
||
| # Enable deb-src repositories for build-dep | ||
| sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources | ||
|
|
||
| # Enable universe repository (needed for some packages like just, fsverity) | ||
| add-apt-repository -y universe | ||
|
|
||
| # Cherry-pick newer container stack from plucky (Ubuntu 25.04). | ||
| # Keep in sync with actions/bootc-ubuntu-setup. | ||
| # The main archive only carries amd64; arm64 uses ports.ubuntu.com. | ||
| if [ "$(dpkg --print-architecture)" = "amd64" ]; then | ||
| mirror="http://archive.ubuntu.com/ubuntu" | ||
| else | ||
| mirror="http://ports.ubuntu.com/ubuntu-ports" | ||
| fi | ||
| echo "deb ${mirror} plucky universe main" > /etc/apt/sources.list.d/plucky.list | ||
|
|
||
| # Enable gh CLI repository | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should share this one with the other images too
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Debian and C10S have gh CLI repo added. |
||
| mkdir -p -m 755 /etc/apt/keyrings | ||
| curl -fLo /etc/apt/keyrings/githubcli-archive-keyring.gpg https://cli.github.com/packages/githubcli-archive-keyring.gpg | ||
| chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg | ||
| mkdir -p -m 755 /etc/apt/sources.list.d | ||
| echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" > /etc/apt/sources.list.d/github-cli.list | ||
|
|
||
| # And re-update after we've fetched repos | ||
| apt -y update | ||
| EORUN | ||
|
|
||
| FROM base AS tools | ||
| # renovate: datasource=github-releases depName=astral-sh/uv | ||
| ARG uvversion=0.10.9 | ||
| COPY fetch-tools.py tool-versions.txt install-uv.sh /run/src/ | ||
| RUN apt -y install python3 && /run/src/fetch-tools.py && apt -y purge python3 && apt -y autoremove | ||
| RUN uvversion=$uvversion /run/src/install-uv.sh | ||
|
|
||
| FROM base AS rust | ||
| # renovate: datasource=custom.rust-nightly depName=rust-nightly versioning=rust-release-channel | ||
| ARG rust_nightly=nightly-2026-03-08 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default value for |
||
| COPY install-rust.sh /run/src/ | ||
| RUN rust_nightly=$rust_nightly /run/src/install-rust.sh | ||
|
|
||
| # Kani formal verification tool - requires rustup for toolchain management | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've gone from 2 to 3 copies of this stuff...which is a baseline rule I have where deduplication is probably wanted.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in my later PR. |
||
| FROM rust AS kani | ||
| # 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/* | ||
| COPY install-kani.sh /run/src/ | ||
| RUN kaniversion=$kaniversion /run/src/install-kani.sh | ||
|
|
||
| # This builds the image. | ||
| # Build this using `just devenv-build-ubuntu` from the root of the repository. | ||
| FROM base | ||
| COPY packages-common.txt packages-ubuntu.txt build-deps-ubuntu.txt /run/src/ | ||
| WORKDIR /run/src | ||
| RUN <<EORUN | ||
| set -xeuo pipefail | ||
| # Install newer container stack from plucky (keep in sync with actions/bootc-ubuntu-setup) | ||
| # skopeo is currently older in plucky for some reason hence --allow-downgrades | ||
| /bin/time -f '%E %C' apt -y install --allow-downgrades crun/plucky podman/plucky skopeo/plucky just | ||
| grep -hEve '^#' packages-common.txt packages-ubuntu.txt | /bin/time -f '%E %C' xargs apt -y install | ||
| grep -vEe '^#' build-deps-ubuntu.txt | /bin/time -f '%E %C' xargs apt -y build-dep | ||
| apt clean && rm -rf /var/lib/apt/lists/* | ||
| EORUN | ||
| 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/ | ||
|
Comment on lines
+83
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| COPY --from=kani /usr/local/bin/* /usr/local/bin/ | ||
| COPY --from=kani /usr/local/rustup /usr/local/rustup | ||
| # Kani bundle (compiler, libraries, CBMC) installed via KANI_HOME during setup | ||
| COPY --from=kani /usr/local/kani /usr/local/kani | ||
| # Point rustup at the system-wide installation, but let CARGO_HOME default to ~/.cargo | ||
| ENV RUSTUP_HOME=/usr/local/rustup | ||
| # Point Kani at the system-wide installation | ||
| ENV KANI_HOME=/usr/local/kani | ||
| # Setup for codespaces | ||
| COPY devenv-init.sh /usr/local/bin/ | ||
| COPY userns-setup /usr/lib/devenv/userns-setup | ||
| COPY devenv-selftest.sh /usr/libexec/ | ||
| RUN chmod 755 /usr/libexec/devenv-selftest.sh /usr/lib/devenv/userns-setup | ||
|
|
||
| WORKDIR / | ||
| # Create user before declaring volumes so home directory has correct ownership | ||
| RUN <<EORUN | ||
| set -xeuo pipefail | ||
| useradd -m devenv -s /bin/bash | ||
| # This needs to be precreated and owned by the devenv user | ||
| mkdir -p ~devenv/.local/share/containers | ||
| chown -R -h devenv: ~devenv/.local | ||
| echo 'devenv ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/devenv && chmod 0440 /etc/sudoers.d/devenv | ||
| EORUN | ||
| # To avoid overlay-on-overlay with nested containers | ||
| VOLUME [ "/var/lib/containers", "/home/devenv/.local/share/containers/" ] | ||
| USER devenv | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ostree |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Ubuntu-specific package names | ||
| # Common packages are in packages-common.txt | ||
|
|
||
| # General build env | ||
| clang-format | ||
| 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 | ||
| libvirt-daemon-system | ||
|
|
||
| # Filesystem verity utilities (composefs testing) | ||
| fsverity | ||
|
|
||
| # TUI editors | ||
| vim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here we may need to go to generating these or at least validating they're in sync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in my later PR.