From c9a53020da06ab1448af7bb539dacde37b9d22e5 Mon Sep 17 00:00:00 2001 From: cyteen Date: Mon, 29 Apr 2024 16:42:33 +0100 Subject: [PATCH] The readme and run scripts it decribes. These are the run scripts used as a basis for the docker-compose.yml --- README.md | 132 +++++++++++++++++++++++++++++++++++++++++++++ TODO.md | 10 ++++ run-it-plain.sh | 11 ++++ run-it.sh | 10 ++++ run-it_sm.sh | 16 ++++++ run-it_sm_part2.sh | 16 ++++++ run.sh | 7 +++ 7 files changed, 202 insertions(+) create mode 100644 README.md create mode 100644 TODO.md create mode 100644 run-it-plain.sh create mode 100644 run-it.sh create mode 100644 run-it_sm.sh create mode 100644 run-it_sm_part2.sh create mode 100644 run.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..a39aaad --- /dev/null +++ b/README.md @@ -0,0 +1,132 @@ +# Docker container for building devuan iso images using the official devuan-live-sdk. + +## Basic functionality + +The Dockerfile will take a git repo of a blend directory as a template, apply +changes to it and commit the result as a new repo. + +The container can then be used to build an ISO image based on that new blend. + +This ISO should be managed by git LFS by: + +`.gitattributes`: + +``` +dist/\*_/_.iso filter=lfs diff=lfs merge=lfs -text +``` + +## Outline + +Put your TEMPLATE_NAME blend under version control or choose someone else's. + +`GITLAB_URL`, `TEMPLATE_NAME`, `BLEND_NAME` are ARGS that can be passed to +`docker build`, the passwords should be managed via ssh-agent + +NB. You might need docker 19.03 or above with + +- `{ "features": { "buildkit": true } }` in /etc/docker/daemon.json +- `# syntax = docker/dockerfile:1.2-labs` at the top of your Dockerfile +- `RUN --mount=type=ssh` before any command needing a password + +See [Dockerfile build enhancement documentation.](https://docs.docker.com/build/dockerfile/frontend/#labs-channel/) + +Installing with `020_docker.sh` will install from docker sources.list and +configure these features. + +```bash +docker build \ + --build-arg GITLAB_URL=git.devuan.org \ + --build-arg TEMPLATE_NAME=devuan-beowulf-live-e17 \ + --build-arg BLEND_NAME=live-zfs-e17 +``` + +Change the URL for the submodules: + +- TEMPLATE_NAME the blend to base the new blend on. DEFAULT devuan-beowulf-live-e17 +- BLEND_NAME the new unique blend to create. DEFAULT live-zfs-e17 +- GITLAB_URL the repo address for the template and the new blend DEFAULT git.devuan.org + +## Building + +build-with-submodules + +Given git credentials, a template name, a blend name and a blend version number +for the new blend the docker build will prepare the new containing to build the +new devuan iso. + +```bash +docker build \ + --squash \ + --progress=plain \ + --no-cache \ + --ssh default \ + --build-arg GITLAB_USER="cyteen" \ + --build-arg GITLAB_URL="git.ring-zero.co.uk" \ + --build-arg GITLAB_PORT="10022" \ + --build-arg APT_MIRROR="https://pkgmaster.devuan.org/merged" \ + --build-arg TEMPLATE_NAME="devuan-beowulf-live-e17" \ + --build-arg RELEASE="beowulf" \ + --build-arg BLEND_NAME="live-zfs-e17" \ + --build-arg BLEND_VERS="3.0-test-$(date +%Y-%m-%d)" \ + --build-arg GIT_EMAIL_NAME="cyteen" \ + --build-arg GIT_EMAIL_URL="ring-zero.co.uk" \ + --build-arg GIT_NAME="Cyteen May" \ + -t markm/devuan-live-sdk_sm:latest \ + -t markm/devuan-live-sdk_sm \ + -f ./Dockerfile-submodule-e17 \ + . +``` + +## Running + +- `run.sh` - just run the container non-interactively +- `run-it.sh` - run the container interactively with /bin/zsh + +### Two stage build + +- `run-it_sm.sh` - first part of the build, interactively: + +```bash +markm/devuan-live-sdk_sm \ + /bin/zsh -f -c source sdk +``` + +- `run-it_sm.sh` - second part of the build, interactively: + +```bash +markm/devuan-live-sdk_sm_part2 \ + /bin/zsh -f -c source sdk +``` + +## Compose + +`docker-compose.yml` and `.env` + +````yaml +version: "3.8" +services: + devuan-live-sdk: + image: markm/devuan-live-sdk_sm:latest + build: + context: . + dockerfile: Dockerfile-submodule-e17 + args: + GITLAB_USER: ${GITLAB_USER} + GITLAB_URL: ${GITLAB_URL} + GITLAB_PORT: ${GITLAB_PORT} + APT_MIRROR: ${APT_MIRROR} + TEMPLATE_NAME: ${TEMPLATE_NAME} + RELEASE: ${RELEASE} + BLEND_NAME: ${BLEND_NAME} + BLEND_VERS: ${BLEND_VERS} + GIT_EMAIL_NAME: ${GIT_EMAIL_NAME} + GIT_EMAIL_URL: ${GIT_EMAIL_URL} + GIT_NAME: ${GIT_NAME} + volumes: + - ./dist:/live-sdk/dist + - ./log:/live-sdk/log + privileged: true + command: -- + ``` + +```` diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..1ad7e37 --- /dev/null +++ b/TODO.md @@ -0,0 +1,10 @@ +# Conversion tasks. + +- Before changing the remotes to point from the gitlab instance to the gitea + git2.ring-zero.co.uk we should test that is still works as intended. + +- Check that the existing commands actually work on the new gitea. + +- minimize the things that the dockfile has in it to produce a zsh rescue ISO. + +- Move to a CI/CD approach to building the images. diff --git a/run-it-plain.sh b/run-it-plain.sh new file mode 100644 index 0000000..b43cfab --- /dev/null +++ b/run-it-plain.sh @@ -0,0 +1,11 @@ +mkdir -p ./dist +#docker run -i -t --rm -v dist:/live-sdk/dist markm/devuan-live-sdk build_iso_dist +#docker run -i -t --rm -v dist:/live-sdk/dist markm/devuan-live-sdk /bin/zsh -f -c 'source sdk' +docker run -i -t \ + --rm \ + --privileged \ + -v ${PWD}/dist:/live-sdk/dist \ + -v ${PWD}/log:/live-sdk/log \ + markm/devuan-live-sdk-plain \ + /bin/zsh + #load devuan amd64 devuan-live diff --git a/run-it.sh b/run-it.sh new file mode 100644 index 0000000..ae33852 --- /dev/null +++ b/run-it.sh @@ -0,0 +1,10 @@ +mkdir -p ./dist +#docker run -i -t --rm -v dist:/live-sdk/dist markm/devuan-live-sdk build_iso_dist +#docker run -i -t --rm -v dist:/live-sdk/dist markm/devuan-live-sdk /bin/zsh -f -c 'source sdk' +docker run -i -t \ + --rm \ + --privileged \ + -v ${PWD}/dist:/live-sdk/dist \ + -v ${PWD}/log:/live-sdk/log \ + markm/devuan-live-sdk \ + /bin/zsh diff --git a/run-it_sm.sh b/run-it_sm.sh new file mode 100644 index 0000000..bd48eae --- /dev/null +++ b/run-it_sm.sh @@ -0,0 +1,16 @@ +mkdir -p ./dist +#docker run -i -t --rm -v dist:/live-sdk/dist markm/devuan-live-sdk build_iso_dist +#docker run -i -t --rm -v dist:/live-sdk/dist markm/devuan-live-sdk /bin/zsh -f -c 'source sdk' + +RELEASE=beowulf +BLEND_NAME=wip-live-zfs-e17 + +docker run -i -t \ + --rm \ + --privileged \ + -v ${PWD}/dist:/live-sdk/dist \ + -v ${PWD}/log:/live-sdk/log \ + -v ${PWD}/packages:/live-sdk/blends/${BLEND_NAME}/${RELEASE}/packages \ + -v ${PWD}/zshenv:/root/.zshenv \ + markm/devuan-live-sdk_sm \ + /bin/zsh -f -c source sdk diff --git a/run-it_sm_part2.sh b/run-it_sm_part2.sh new file mode 100644 index 0000000..c318bd0 --- /dev/null +++ b/run-it_sm_part2.sh @@ -0,0 +1,16 @@ +mkdir -p ./dist +#docker run -i -t --rm -v dist:/live-sdk/dist markm/devuan-live-sdk build_iso_dist +#docker run -i -t --rm -v dist:/live-sdk/dist markm/devuan-live-sdk /bin/zsh -f -c 'source sdk' + +RELEASE=beowulf +BLEND_NAME=wip-live-zfs-e17 + +docker run -i -t \ + --rm \ + --privileged \ + -v ${PWD}/dist:/live-sdk/dist \ + -v ${PWD}/log:/live-sdk/log \ + -v ${PWD}/packages:/live-sdk/blends/${BLEND_NAME}/${RELEASE}/packages \ + -v ${PWD}/zshenv:/root/.zshenv \ + markm/devuan-live-sdk_sm_part2 \ + /bin/zsh -f -c source sdk diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..ff906b5 --- /dev/null +++ b/run.sh @@ -0,0 +1,7 @@ +mkdir -p ./dist +docker run \ + --rm \ + --privileged \ + -v ${PWD}/dist:/live-sdk/dist \ + -v ${PWD}/log:/live-sdk/log \ + markm/devuan-live-sdk