Skip to content

Building with Docker

Guy Sheffer edited this page Apr 21, 2020 · 21 revisions

Docker building image is available at Docker Hub. Ensure you have set up the loop module if necessary (sudo modprobe loop).

Docker Run

To use it go the folder of your distro and run:

cd distro/src
docker run -v `pwd`:/distro --name mydistro_builder --device /dev/loop-control guysoft/custompios:devel

Docker-Compose

You can also use this example docker-compose.yml in distro/src (src/docker/docker-compose.yml):

version: '3.6'

services:
  custompios:
    image: guysoft/custompios:devel
    container_name: mydistro_builder
    tty: true
    restart: always
    privileged: true
    volumes:
      - ./:/distro
    devices:
      - /dev/loop-control

Note: you are mounting the src folder of your image to the docker container.

To build a variant on the machine simply run:

docker exec -it mydistro_builder build

In older versions you do:

    docker exec -it mydistro_builder /CustomPiOS/nightly_build_scripts/custompios_nightly_build

Your image would be created as a zip file at distro/src/workspace If you are building a variant it will appear in distro/src/workspace-{variant-name}

Auto-update using containrrr/watchtower

It is recommended to build against the latest in the CustomPiOS repo, there is an automated build, so you can add a watchtower that will always keep the CustomPiOS docker image up do date, by using v2tec/watchtower:

version: '3.6'

services:
  custompios:
    image: guysoft/custompios:devel
    container_name: ${DISTRO_NAME}-build
    tty: true
    restart: always
    privileged: true
    volumes:
      - ./:/distro
    devices:
      - /dev/loop-control
    labels:
      - com.centurylinklabs.watchtower.enable=true

  watchtower:
    image: containrrr/watchtower
    container_name: custompios-watcher
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /root/.docker/config.json:/config.json
    command: --cleanup --label-enable --interval 30
    restart: always

Then:

echo "DISTRO_NAME" > .env
Clone this wiki locally