Cache podman steps and move rustinstall.sh into containerfile

This commit is contained in:
Jeremy Soller 2026-02-17 11:37:12 -07:00
parent 9844d544d0
commit 6fefa33444
3 changed files with 35 additions and 23 deletions

View File

@ -14,6 +14,20 @@ else
PODMAN_VOLUME_FLAG=
endif
# Cache layers to redox-os docker hub
PODMAN_CACHE=
PODMAN_CACHE_PATH=docker.io/redoxos/$(IMAGE_TAG)
PODMAN_CACHE_PULL?=1
ifeq ($(PODMAN_CACHE_PULL),1)
PODMAN_CACHE+=--cache-from=$(PODMAN_CACHE_PATH)
endif
PODMAN_CACHE_PUSH?=0
ifeq ($(PODMAN_CACHE_PUSH),1)
PODMAN_CACHE+=--cache-to=$(PODMAN_CACHE_PATH)
endif
## Podman Home Directory
PODMAN_HOME=$(ROOT)/build/podman
## Podman command with its many arguments
@ -58,8 +72,7 @@ ifeq ($(PODMAN_BUILD),1)
-podman image rm --force $(IMAGE_TAG) || true
mkdir -p $(PODMAN_HOME)
@echo "Building Podman image. This may take some time."
cat $(CONTAINERFILE) | podman build --file - $(PODMAN_VOLUMES) --tag $(IMAGE_TAG)
$(PODMAN_RUN) bash -e podman/rustinstall.sh
cat $(CONTAINERFILE) | podman build --file - $(PODMAN_VOLUMES) $(PODMAN_CACHE) --tag $(IMAGE_TAG)
mkdir -p build
touch $@
@echo "Podman ready!"
@ -67,6 +80,9 @@ else
@echo PODMAN_BUILD=$(PODMAN_BUILD), container not required.
endif
container_push: build/container.tag
podman push $(IMAGE_TAG) $(PODMAN_CACHE_PATH)
KERNEL_PATH := recipes/core/kernel
KERNEL_PATH_SOURCE := $(ROOT)/$(KERNEL_PATH)/source
KERNEL_PATH_TARGET := $(ROOT)/$(KERNEL_PATH)/target/$(TARGET)

View File

@ -84,3 +84,20 @@ RUN apt-get update \
libc6-dev-i386 \
syslinux-utils \
; fi
RUN echo "Installing rust..." && \
curl "https://sh.rustup.rs" -sSf | sh -s -- -y --default-toolchain stable --profile minimal
RUN echo "Downloading sccache..." && \
SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-$(uname -m)-unknown-linux-musl.tar.gz" && \
wget -qO- --show-progress "${SCCACHE_URL}" | tar -xz -C ~/.cargo/bin --strip-components=1 --wildcards '*/sccache'
RUN echo "Downloading just..." && \
JUST_URL="https://github.com/casey/just/releases/download/1.45.0/just-1.45.0-$(uname -m)-unknown-linux-musl.tar.gz" && \
wget -qO- --show-progress "${JUST_URL}" | tar -xz -C ~/.cargo/bin --wildcards 'just'
RUN echo "Downloading cbindgen..." && \
CBINDGEN_NAME="$( [ "$(uname -m)" = "x86_64" ] && echo "ubuntu22.04" || echo "ubuntu22.04-aarch64" )" && \
CBINDGEN_URL="https://github.com/mozilla/cbindgen/releases/download/0.29.0/cbindgen-${CBINDGEN_NAME}" && \
wget -qO- --show-progress "${CBINDGEN_URL}" > ~/.cargo/bin/cbindgen && \
chmod +x ~/.cargo/bin/cbindgen

View File

@ -1,21 +0,0 @@
#/usr/bin/env bash
# This script install the Rust toolchain and the build system dependencies
# in Podman after the image has been built
echo Installing rust...
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal
echo Downloading sccache...
SCCACHE_URL=https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-$(uname -m)-unknown-linux-musl.tar.gz
wget -qO- --show-progress $SCCACHE_URL | tar -xz -C ~/.cargo/bin --strip-components=1 --wildcards '*/sccache'
echo Downloading just...
JUST_URL=https://github.com/casey/just/releases/download/1.45.0/just-1.45.0-$(uname -m)-unknown-linux-musl.tar.gz
wget -qO- --show-progress $JUST_URL | tar -xz -C ~/.cargo/bin --wildcards 'just'
echo Downloading cbindgen...
CBINDGEN_NAME=$( [[ $(uname -m) = "x86_64" ]] && echo "ubuntu22.04" || echo "ubuntu22.04-aarch64" )
CBINDGEN_URL=https://github.com/mozilla/cbindgen/releases/download/0.29.0/cbindgen-$CBINDGEN_NAME
wget -qO- --show-progress $CBINDGEN_URL > ~/.cargo/bin/cbindgen
chmod +x ~/.cargo/bin/cbindgen