From 3598be3ba023db867f8003f4dd7012d957a6cce5 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Fri, 21 Apr 2023 00:00:45 +0200 Subject: [PATCH] README: update to GitHub Signed-off-by: Paul Spooren --- README.md | 155 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 103 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 1ef175e..1677bf6 100644 --- a/README.md +++ b/README.md @@ -4,67 +4,88 @@ [![CI][ci-badge]][ci-ref] [![Docker Hub][docker-hub-badge]][docker-hub-ref] -This repository contains scripts to create Docker containers for OpenWrt. The -scripts are run via an CI and upload such containers to docker.io. -Used variables are `VERSION`, `TARGET`, `DOCKER_USER`, `DOCKER_PASS` and `DOCKER_IMAGE`. +This repository contains files to create OpenWrt containers. While mostly used +for our CI you may use the scripts to build containers on your own. -`$VERSION`: OpenWrt version to build (e.g. "snapshot" or "19.07.4") -`$TARGET`: OpenWrt target to build (e.g. "x86-64") -`$DOCKER_USER`: user to upload -`$DOCKER_PASS`: passwort to upload -`$DOCKER_IMAGE`: image name +> **Warning** +> We switch our docker.io account from `openwrtorg` to `openwrt` -To build multiple targets use the `gen-targets.sh` script which generates the -files `targets.yml` and `targets_rootfs.yml`, which are imported by the GitLab -runner. This allows to run multiple jobs in parallel. +Available containers: -See `.gitlab-ci.yml` for the current setup. +* `imagebuilder` create firmware images +* `sdk` compile OpenWrt packages +* `rootfs` test software inside an OpenWrt runtime + +All containers are mirrored to the follwing three registries: + +* docker.io +* ghcr.io +* quay.io + +Find more details on the container types below ## `sdk` Contains the [OpenWrt SDK](https://openwrt.org/docs/guide-developer/toolchain/using_the_sdk) based on -a `debian:latest` container with required packages preinstalled. This can be -useful when building packages on MacOS X, Windows or via CI. +the same container we use for our [Buildbot](https://buildbot.org) +infrastructure. This can be useful when building packages on macOS, Windows or +via CI. -### Example +### SDK Example - docker run --rm -v "$(pwd)"/bin/:/home/build/openwrt/bin -it openwrt/sdk - # within the Docker container - ./scripts/feeds update base - make defconfig - ./scripts/feeds install firewall - make package/firewall/{clean,compile} -j$(nproc) +```shell +docker run --rm -v "$(pwd)"/bin/:/builder/bin -it openwrt/sdk +# inside the Docker container +./scripts/feeds update packages +make defconfig +./scripts/feeds install tmate +make package/tmate/{clean,compile} -j$(nproc) +``` -Enjoy a local OpenWrt SDK container building the `firewall3` package and but the +Enjoy a local OpenWrt SDK container building the `tmate` package and but the binary in hosts `./bin` folder. -### Tags +### SDK Tags -All currently available SDKs via lower case `-[-]`, -appending `19.07-SNAPSHOT` or `18.06.4` let's you build other than snapshots. +All currently available SDKs via tags in the following format: + +* `-[-]` + +The `branch|tag|version` can be something like `openwrt-22.03` (branch), +`v22.03.4` (tag) or `21.02.3` (version). To use daily builds use either `master` +or `SNAPSHOT`. ## `imagebuilder` Contains the [OpenWrt ImageBuilder](https://openwrt.org/docs/guide-user/additional-software/imagebuilder) -based on a `debian:latest` container with required packages preinstalled. This -can be useful when creating images on MacOS X, Windows or via CI. +based on the same container we use for our [buildbot](buildbot.org) +infrastructure. This can be useful when creating images on macOS, Windows or +via CI. -### Example +### ImageBuilder Example - docker run --rm -v "$(pwd)"/bin/:/home/build/openwrt/bin -it openwrt/imagebuilder - # within the Docker container - make image +```shell +docker run --rm -v "$(pwd)"/bin/:/builder/bin -it openwrt/imagebuilder +# inside the Docker container +make image PROFILE=generic PACKAGES=tmate +``` Enjoy a local OpenWrt ImageBuilder container building an image for x86/64 and store the binary in hosts `./bin` folder. -### Tags +### ImageBuilder Tags -All currently available SDKs via lower case `-[-]`, -appending `19.07-SNAPSHOT` or `18.06.4` let's you build other than snapshots. +All currently available ImageBuilders via tags in the following format: + +* `-[-]` +* `[-]` + +The `branch|tag|version` can be something like `openwrt-22.03` (branch), +`v22.03.4` (tag) or `21.02.3` (version). To use daily builds use either `master` +or `SNAPSHOT`. ## `rootfs` (experimental) @@ -76,28 +97,58 @@ An unpackaged version of OpenWrt's rootfs for different architectures. The `./rootfs` folder requires slight modifications to work within Docker, additional files for the rootfs should be added there before building. -### Example +### Rootfs Example - docker run --rm -it openwrt/rootfs +```shell +docker run --rm -it openwrt/rootfs +# inside the Docker container +mkdir /var/lock/ +opkg update +opkg install tmate +tmate +``` -Enjoy a local OpenWrt container with internet access. Once closed the image is -removed. +Enjoy a local OpenWrt container running the x86/64 architecture with internet +access. Once closed the container is removed. -### Tags +### Rootfs Tags -* x86_64 -* armvirt-32 -* armvirt-64 -* arm_cortex-a15_neon-vfpv4 -* arm_cortex-a9_vfpv3-d16 -* aarch64_generic -* mips_24kc -* malta-be -* i386_pentium4 +"|||armvirt/32|armvirt/64|malta/be|mvebu/cortexa9 -[ci-badge]: https://gitlab.com/openwrtorg/docker/badges/master/pipeline.svg -[ci-ref]: https://gitlab.com/openwrtorg/docker/commits/master -[docker-hub-badge]: https://img.shields.io/badge/docker--hub-openwrtorg-blue.svg?style=flat-square -[docker-hub-ref]: https://hub.docker.com/u/openwrtorg +* `x86/64` or `x86_64` +* `x86/generic` or `i386_pentium4` +* `x86/geode` or `i386_pentium-mmx` +* `armvirt/32` or `arm_cortex-a15_neon-vfpv4` +* `armvirt/64` or `aarch64_cortex-a53` +* `malta/be` or `mips_24kc` +* `mvebu/cortexa9` or `arm_cortex-a9_vfpv3-d16` + +## Build Your Own + +If you wan to create your own container you can use the `Dockerfile`. You can set the following build arguments: + +* `TARGET` - the target to build for (e.g. `x86/64`) +* `DOWNLOAD_FILE` - the file to download (e.g. `imagebuilder-.*x86_64.tar.xz`) +* `FILE_HOST` - the host to download the ImageBuilder/SDK/rootfs from (e.g. `downloads.openwrt.org`) +* `VERSION_PATH` - the path to the ImageBuilder/SDK/rootfs (e.g. `snapshots` or `releases/21.02.3`) + +### Example ImageBuilder + +> If you plan to use your own server please add your own GPG key to the +> `./keys/` folder. + +```shell +docker build \ + --build-arg TARGET=x86/64 \ + --build-arg DOWNLOAD_FILE="imagebuilder-.*x86_64.tar.xz" \ + --build-arg FILE_HOST=downloads.openwrt.org \ + --build-arg VERSION_PATH=snapshots \ + -t openwrt/x86_64 . +``` + +[ci-badge]: https://github.com/openwrt/docker/actions/workflows/containers.yml/badge.svg +[ci-ref]: https://github.com/openwrt/docker/actions/workflows/containers.yml +[docker-hub-badge]: https://img.shields.io/badge/docker--hub-openwrt-blue.svg?style=flat-square +[docker-hub-ref]: https://hub.docker.com/u/openwrt [license-badge]: https://img.shields.io/github/license/openwrt/docker.svg?style=flat-square [license-ref]: LICENSE