Skip to content

Commit

Permalink
Merge pull request #77 from qmsk/docker-compose-github-actions-update
Browse files Browse the repository at this point in the history
Fix GitHub Actions, Docker Compose V2 usage
  • Loading branch information
SpComb authored Aug 2, 2024
2 parents 7194681 + 29aa9e1 commit bfb22b5
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 108 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:

jobs:
build-web:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

defaults:
run:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
build-esp32:
needs:
- build-web
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Setup
run: |
Expand All @@ -64,11 +64,11 @@ jobs:
path: web/dist

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

# XXX: build --load -> build --output=type=docker is almost as slow as uncached build...
- name: Build SDK
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
build-args: |
ESP_IDF_VERSION=${{ env.ESP_IDF_VERSION }}
Expand All @@ -82,7 +82,7 @@ jobs:
tags: qmsk/esp-idf:dev

- name: Build
run: docker-compose -f projects/esp32/docker-compose.yml run --rm build
run: docker compose -f projects/esp32/docker-compose.yml run --rm build

- name: Upload esp32-build
uses: actions/upload-artifact@v3
Expand All @@ -104,7 +104,7 @@ jobs:
build-esp8266:
needs:
- build-web
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Setup
run: |
Expand All @@ -120,11 +120,11 @@ jobs:
path: web/dist

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

# XXX: build --load -> build --output=type=docker is almost as slow as uncached build...
- name: Build SDK
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
build-args: |
ESP8266_RTOS_SDK_VERSION=${{ env.ESP8266_RTOS_SDK_VERSION }}
Expand All @@ -136,7 +136,7 @@ jobs:
tags: qmsk/esp8266-rtos-sdk:dev

- name: Build
run: docker-compose -f projects/esp8266/docker-compose.yml run --rm build make defconfig all write_flash_args
run: docker compose -f projects/esp8266/docker-compose.yml run --rm build make defconfig all write_flash_args

- name: Upload esp8266-build
uses: actions/upload-artifact@v3
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,44 +31,44 @@ ESP8266/32 based Art-NET over WiFi node for RGBW pixel LEDs with support for mul

Run the webpack build for the `web-dist` files to be included in the SPIFFS image:

$ USER_ID=$UID docker-compose -f web/docker-compose.yml run --rm npm install
$ USER_ID=$UID docker-compose -f web/docker-compose.yml run --rm npm run build
$ USER_ID=$UID docker compose -f web/docker-compose.yml run --rm npm install
$ USER_ID=$UID docker compose -f web/docker-compose.yml run --rm npm run build

## ESP8266

Using the docker-based [Espressif ESP8266 RTOS SDK](https://github.com/espressif/ESP8266_RTOS_SDK) [v3.4](https://github.com/espressif/ESP8266_RTOS_SDK/releases/tag/v3.4) + patches SDK/toolchain:

$ docker-compose -f projects/esp8266/docker-compose.yml build sdk
$ docker compose -f projects/esp8266/docker-compose.yml build sdk

Build firmware images (bootloader + app + web-dist):

$ USER_ID=$UID docker-compose -f projects/esp8266/docker-compose.yml run --rm build
$ USER_ID=$UID docker compose -f projects/esp8266/docker-compose.yml run --rm build

Flash firmware images (bootloader + app + web-dist) to NodeMCU devkit:

$ ESPPORT=/dev/ttyUSB? docker-compose -f projects/esp8266/docker-compose.yml run --rm flash
$ ESPPORT=/dev/ttyUSB? docker compose -f projects/esp8266/docker-compose.devices.yml run --rm flash

Access the USB console:

$ ESPPORT=/dev/ttyUSB? docker-compose -f projects/esp8266/docker-compose.yml run --rm monitor
$ ESPPORT=/dev/ttyUSB? docker compose -f projects/esp8266/docker-compose.devices.yml run --rm monitor

## ESP32

Using the docker-based [Espressif ESP-IDF](https://github.com/espressif/esp-idf) [v4.4](https://github.com/espressif/esp-idf/releases/tag/v4.4.4) + patches SDK/toolchain:

$ BUILD_UID=$(id -u) BUILD_GID=$(id -g) docker-compose -f projects/esp32/docker-compose.yml build sdk
$ BUILD_UID=$(id -u) BUILD_GID=$(id -g) docker compose -f projects/esp32/docker-compose.yml build sdk

Build firmware images (bootloader + app + web-dist):

$ docker-compose -f projects/esp32/docker-compose.yml run --rm build
$ docker compose -f projects/esp32/docker-compose.yml run --rm build

Flash firmware images (bootloader + app + web-dist) to the ESP32-devkit:

$ ESPPORT=/dev/ttyUSB? docker-compose -f projects/esp32/docker-compose.yml run --rm flash
$ ESPPORT=/dev/ttyUSB? docker compose -f projects/esp32/docker-compose.devices.yml run --rm flash

Access the USB console:

$ ESPPORT=/dev/ttyUSB? docker-compose -f projects/esp32/docker-compose.yml run --rm monitor
$ ESPPORT=/dev/ttyUSB? docker compose -f projects/esp32/docker-compose.devices.yml run --rm monitor

# Usage

Expand All @@ -82,7 +82,7 @@ Please configure a WiFi password, and optionally a HTTP username/password.

By default, the ESP8266 will print log messages and open a CLI console on UART0, which can be accessed via the same USB UART used for bootloader flashing:

ESPPORT=/dev/ttyUSB? docker-compose run --rm monitor
ESPPORT=/dev/ttyUSB? docker compose run --rm monitor

If using the UART0 pins for other IO (e.g. `spi-leds` I2S interface), the console can be closed manually using the `exit` command,
or automatically at boot using the `timeout` config. The console can be re-started using a short press on the FLASH button;
Expand Down Expand Up @@ -357,7 +357,7 @@ artnet_universe = 0

To recover from a broken configuration, either press and hold the FLASH button, or erase the SPIFFS partition using the USB bootloader:

ESPPORT=/dev/ttyUSB? docker-compose run --rm config-reset
ESPPORT=/dev/ttyUSB? docker compose run --rm config-reset

# Components

Expand Down
30 changes: 30 additions & 0 deletions projects/esp32/docker-compose.devices.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Usage:
# $ ESPPORT=/dev/ttyUSB0 docker compose -f docker-compose.devices.yml run --rm monitor
services:

flash:
image: qmsk/esp-idf:dev
volumes:
- ../..:/build
working_dir: /build/projects/esp32
command: idf.py flash
init: true
read_only: true
devices:
- "${ESPPORT}"
environment:
ESPPORT: "${ESPPORT}"

monitor:
image: qmsk/esp-idf:dev
volumes:
- ../..:/build
working_dir: /build/projects/esp32
command: idf.py monitor
init: true
read_only: true
devices:
- "${ESPPORT}"
environment:
ESPPORT: "${ESPPORT}"
BOARDCONFIG: "${BOARDCONFIG}"
33 changes: 2 additions & 31 deletions projects/esp32/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Usage:
# $ BUILD_UID=$(id -u) BUILD_GID=$(id -g) docker-compose build sdk
# $ docker-compose run --rm build
# $ ESPPORT=/dev/ttyUSB0 docker-compose run --rm monitor
version: '3.8'
# $ BUILD_UID=$(id -u) BUILD_GID=$(id -g) docker compose build sdk
# $ docker compose run --rm build
services:
sdk:
image: qmsk/esp-idf:dev
Expand All @@ -25,30 +23,3 @@ services:
read_only: true
environment:
BOARDCONFIG: "${BOARDCONFIG}"

flash:
image: qmsk/esp-idf:dev
volumes:
- ../..:/build
working_dir: /build/projects/esp32
command: idf.py flash
init: true
read_only: true
devices:
- "${ESPPORT}"
environment:
ESPPORT: "${ESPPORT}"

monitor:
image: qmsk/esp-idf:dev
volumes:
- ../..:/build
working_dir: /build/projects/esp32
command: idf.py monitor
init: true
read_only: true
devices:
- "${ESPPORT}"
environment:
ESPPORT: "${ESPPORT}"
BOARDCONFIG: "${BOARDCONFIG}"
50 changes: 50 additions & 0 deletions projects/esp8266/docker-compose.devices.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# USAGE:
#
# ESPPORT=/dev/ttyUSB? docker compose up flash
# ESPPORT=/dev/ttyUSB? docker compose run --rm monitor
# ESPPORT=/dev/ttyUSB? docker compose up config-reset
#
# @see https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/index.html#environment-variables
services:
flash:
image: qmsk/esp8266-rtos-sdk:dev
volumes:
- ../..:/build
working_dir: /build/projects/esp8266
user: build
command: make flash
init: true
devices:
- "${ESPPORT}"
environment:
SDKCONFIG: sdkconfig@${BOARDCONFIG:-qmsk-esp}
ESPPORT: "${ESPPORT}"

config-reset:
image: qmsk/esp8266-rtos-sdk:dev
volumes:
- ../..:/build
working_dir: /build/projects/esp8266
user: build
command: make config-reset
init: true
devices:
- "${ESPPORT}"
environment:
SDKCONFIG: sdkconfig@${BOARDCONFIG:-qmsk-esp}
ESPPORT: "${ESPPORT}"

monitor:
image: qmsk/esp8266-rtos-sdk:dev
volumes:
- ../..:/build
working_dir: /build/projects/esp8266
user: build
command: make monitor MONITOR_OPTS="--baud $${MONITORBAUD} --port $${ESPPORT} --eol CRLF"
init: true
devices:
- "${ESPPORT}"
environment:
SDKCONFIG: sdkconfig@${BOARDCONFIG:-qmsk-esp}
ESPPORT: "${ESPPORT}"
MONITORBAUD: "${MONITORBAUD:-115200}"
51 changes: 2 additions & 49 deletions projects/esp8266/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# USAGE:
#
# docker-compose build sdk
# USER_ID=$UID docker-compose up build
# ESPPORT=/dev/ttyUSB? docker-compose up flash
# ESPPORT=/dev/ttyUSB? docker-compose run --rm monitor
# ESPPORT=/dev/ttyUSB? docker-compose up config-reset
# docker compose build sdk
# USER_ID=$UID docker compose up build
#
# @see https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/index.html#environment-variables
version: '3.8'
services:
sdk:
image: qmsk/esp8266-rtos-sdk:dev
Expand All @@ -28,46 +24,3 @@ services:
BOARDCONFIG: ${BOARDCONFIG:-qmsk-esp}
SDKCONFIG: sdkconfig@${BOARDCONFIG:-qmsk-esp}
SDKCONFIG_DEFAULTS: sdkconfig.defaults boardconfig/${BOARDCONFIG:-qmsk-esp}

flash:
image: qmsk/esp8266-rtos-sdk:dev
volumes:
- ../..:/build
working_dir: /build/projects/esp8266
user: build
command: make flash
init: true
devices:
- "${ESPPORT}"
environment:
SDKCONFIG: sdkconfig@${BOARDCONFIG:-qmsk-esp}
ESPPORT: "${ESPPORT}"

config-reset:
image: qmsk/esp8266-rtos-sdk:dev
volumes:
- ../..:/build
working_dir: /build/projects/esp8266
user: build
command: make config-reset
init: true
devices:
- "${ESPPORT}"
environment:
SDKCONFIG: sdkconfig@${BOARDCONFIG:-qmsk-esp}
ESPPORT: "${ESPPORT}"

monitor:
image: qmsk/esp8266-rtos-sdk:dev
volumes:
- ../..:/build
working_dir: /build/projects/esp8266
user: build
command: make monitor MONITOR_OPTS="--baud $${MONITORBAUD} --port $${ESPPORT} --eol CRLF"
init: true
devices:
- "${ESPPORT}"
environment:
SDKCONFIG: sdkconfig@${BOARDCONFIG:-qmsk-esp}
ESPPORT: "${ESPPORT}"
MONITORBAUD: "${MONITORBAUD:-115200}"
4 changes: 2 additions & 2 deletions sdk/esp-idf/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM debian:bullseye
FROM debian:bookworm

# dependencies
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-setup.html
RUN apt-get update && apt-get install -y \
git wget flex bison gperf \
python3 python3-pip python3-setuptools \
python3 python3-pip python3-setuptools python3-virtualenv \
cmake ninja-build ccache dfu-util \
libffi-dev libssl-dev libusb-1.0-0

Expand Down
2 changes: 1 addition & 1 deletion sdk/esp8266-rtos-sdk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ COPY patches/ /tmp/patches
RUN for patch in /tmp/patches/*.patch; do patch -d $IDF_PATH -p1 < "$patch" || exit 1; done

RUN \
python -m pip install -r $IDF_PATH/requirements.txt
python -m pip install --no-build-isolation -r $IDF_PATH/requirements.txt

RUN \
make -C $IDF_PATH/tools/kconfig
Expand Down
7 changes: 3 additions & 4 deletions web/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Usage:
# USER_ID=$UID docker-compose run --rm npm install
# USER_ID=$UID docker-compose run --rm npm run build
# USER_ID=$UID API_URL=http://172.29.16.47 docker-compose run --rm npm start
version: '3.8'
# USER_ID=$UID docker compose run --rm npm install
# USER_ID=$UID docker compose run --rm npm run build
# USER_ID=$UID API_URL=http://172.29.16.47 docker compose run --rm npm start
services:
npm:
build:
Expand Down

0 comments on commit bfb22b5

Please sign in to comment.