move Rust install to a persistent container dir
This commit is contained in:
parent
35832abf8a
commit
2e42fbb6c8
18
mk/podman.mk
18
mk/podman.mk
|
@ -8,8 +8,10 @@
|
||||||
IMAGE_TAG?=redox-base
|
IMAGE_TAG?=redox-base
|
||||||
## Working Directory in Podman
|
## Working Directory in Podman
|
||||||
CONTAINER_WORKDIR?=/mnt/redox
|
CONTAINER_WORKDIR?=/mnt/redox
|
||||||
|
## Podman Home Directory
|
||||||
|
PODMAN_HOME?=$(HOME)/.local/share/containers/storage/podman_home
|
||||||
## Podman command with its many arguments
|
## Podman command with its many arguments
|
||||||
PODMAN_VOLUMES?=--volume "`pwd`":$(CONTAINER_WORKDIR):Z
|
PODMAN_VOLUMES?=--volume "`pwd`":$(CONTAINER_WORKDIR):Z --volume $(PODMAN_HOME):/home:Z
|
||||||
PODMAN_ENV?=--env PATH=/home/poduser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env PODMAN_BUILD=0
|
PODMAN_ENV?=--env PATH=/home/poduser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env PODMAN_BUILD=0
|
||||||
PODMAN_CONFIG?=--env ARCH=$(ARCH) --env CONFIG_NAME=$(CONFIG_NAME) --env FILESYSTEM_CONFIG=$(FILESYSTEM_CONFIG)
|
PODMAN_CONFIG?=--env ARCH=$(ARCH) --env CONFIG_NAME=$(CONFIG_NAME) --env FILESYSTEM_CONFIG=$(FILESYSTEM_CONFIG)
|
||||||
PODMAN_OPTIONS?=--rm --workdir $(CONTAINER_WORKDIR) --userns keep-id --user `id -u` --interactive --tty --env TERM=$(TERM)
|
PODMAN_OPTIONS?=--rm --workdir $(CONTAINER_WORKDIR) --userns keep-id --user `id -u` --interactive --tty --env TERM=$(TERM)
|
||||||
|
@ -24,13 +26,16 @@ endif
|
||||||
|
|
||||||
container_clean: FORCE
|
container_clean: FORCE
|
||||||
rm -f build/container.tag
|
rm -f build/container.tag
|
||||||
|
@echo "If podman_home dir cannot be removed, "
|
||||||
|
@echo "remove with either \"sudo rm\" or \"podman system reset\"."
|
||||||
|
-rm -rf $(PODMAN_HOME) || true
|
||||||
@echo "For complete clean of images and containers, use \"podman system reset\""
|
@echo "For complete clean of images and containers, use \"podman system reset\""
|
||||||
-podman image rm --force $(IMAGE_TAG) || true
|
-podman image rm --force $(IMAGE_TAG) || true
|
||||||
|
|
||||||
container_touch: FORCE
|
container_touch: FORCE
|
||||||
ifeq ($(PODMAN_BUILD),1)
|
ifeq ($(PODMAN_BUILD),1)
|
||||||
@echo If you get an error, the image does not exist. Just do a normal make.
|
rm -f build/container.tag
|
||||||
podman image exists $(IMAGE_TAG)
|
podman image exists $(IMAGE_TAG) || (echo "Image does not exist, it will be rebuilt during normal make."; exit 1)
|
||||||
touch build/container.tag
|
touch build/container.tag
|
||||||
else
|
else
|
||||||
@echo PODMAN_BUILD=$(PODMAN_BUILD), container not required.
|
@echo PODMAN_BUILD=$(PODMAN_BUILD), container not required.
|
||||||
|
@ -40,13 +45,18 @@ endif
|
||||||
build/container.tag: $(CONTAINERFILE)
|
build/container.tag: $(CONTAINERFILE)
|
||||||
ifeq ($(PODMAN_BUILD),1)
|
ifeq ($(PODMAN_BUILD),1)
|
||||||
rm -f build/container.tag
|
rm -f build/container.tag
|
||||||
|
@echo "If podman_home dir cannot be removed, "
|
||||||
|
@echo "remove with either \"sudo rm\" or \"podman system reset\"."
|
||||||
|
-rm -rf $(PODMAN_HOME) || true
|
||||||
-podman image rm --force $(IMAGE_TAG) || true
|
-podman image rm --force $(IMAGE_TAG) || true
|
||||||
|
mkdir -p $(PODMAN_HOME)
|
||||||
@echo "Building Podman image. This may take some time."
|
@echo "Building Podman image. This may take some time."
|
||||||
sed s/_UID_/`id -u`/ $(CONTAINERFILE) | podman build --file - $(PODMAN_VOLUMES) --tag $(IMAGE_TAG)
|
sed s/_UID_/`id -u`/ $(CONTAINERFILE) | podman build --file - $(PODMAN_VOLUMES) --tag $(IMAGE_TAG)
|
||||||
@echo "Mapping Podman user space. Please wait."
|
@echo "Mapping Podman user space. Please wait."
|
||||||
$(PODMAN_RUN) echo "Podman ready!"
|
$(PODMAN_RUN) bash -e podman/rustinstall.sh
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
touch $@
|
touch $@
|
||||||
|
@echo "Podman ready!"
|
||||||
else
|
else
|
||||||
@echo PODMAN_BUILD=$(PODMAN_BUILD), container not required.
|
@echo PODMAN_BUILD=$(PODMAN_BUILD), container not required.
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -38,12 +38,8 @@ RUN apt-get update \
|
||||||
wget
|
wget
|
||||||
|
|
||||||
# _UID_ must be replaced with the user's uid on host
|
# _UID_ must be replaced with the user's uid on host
|
||||||
RUN useradd --create-home --no-log-init --uid _UID_ poduser
|
# podman root is mapped to your user id on host during build,
|
||||||
|
# poduser is mapped to your user id during podman run
|
||||||
|
RUN useradd --create-home --no-log-init --uid _UID_ poduser && \
|
||||||
|
chown -R root:root /home
|
||||||
|
|
||||||
USER poduser
|
|
||||||
|
|
||||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly && \
|
|
||||||
/home/poduser/.cargo/bin/cargo install --force --version 0.1.1 cargo-config && \
|
|
||||||
/home/poduser/.cargo/bin/cargo install --force --version 0.3.20 xargo
|
|
||||||
|
|
||||||
CMD [ "bash", "-c"]
|
|
7
podman/rustinstall.sh
Executable file
7
podman/rustinstall.sh
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#/usr/bin/env bash
|
||||||
|
|
||||||
|
# Install Rust in Podman, after the image has been built
|
||||||
|
|
||||||
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly
|
||||||
|
cargo install --force --version 0.1.1 cargo-config
|
||||||
|
cargo install --force --version 0.3.20 xargo
|
Loading…
Reference in a new issue