The readme and run scripts it decribes.

These are the run scripts used as a basis for the docker-compose.yml
This commit is contained in:
cyteen 2024-04-29 16:42:33 +01:00
parent 7d87b85861
commit c9a53020da
7 changed files with 202 additions and 0 deletions

132
README.md Normal file
View File

@ -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: --
```
````

10
TODO.md Normal file
View File

@ -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.

11
run-it-plain.sh Normal file
View File

@ -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

10
run-it.sh Normal file
View File

@ -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

16
run-it_sm.sh Normal file
View File

@ -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

16
run-it_sm_part2.sh Normal file
View File

@ -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

7
run.sh Normal file
View File

@ -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