feat: add pre-built ESP-IDF toolchain image workflow

pull/91/head
David Montero Crespo 2026-04-04 18:02:48 -03:00
parent 0a724b7566
commit b73f28c174
3 changed files with 72 additions and 2 deletions

View File

@ -0,0 +1,42 @@
name: Build ESP-IDF Toolchain Image
# Only runs manually or when ESP-IDF version changes (rare)
on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/velxio-espidf-toolchain
permissions:
contents: read
packages: write
jobs:
build-toolchain:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ESP-IDF toolchain image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.espidf-toolchain
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:idf-4.4.7
cache-from: type=gha,scope=espidf
cache-to: type=gha,scope=espidf,mode=max

View File

@ -0,0 +1,28 @@
# ESP-IDF toolchain image — built once, pulled many times.
# Published to GHCR by build-espidf-toolchain.yml Action.
# Usage: docker build -f Dockerfile.espidf-toolchain -t velxio-espidf-toolchain .
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
git wget flex bison gperf python3 python3-pip python3-venv \
cmake ninja-build ccache libffi-dev libssl-dev \
libusb-1.0-0 ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install ESP-IDF 4.4.7 (matches Arduino ESP32 core 2.0.17 / lcgamboa QEMU ROM)
RUN git clone -b v4.4.7 --recursive --depth=1 --shallow-submodules \
https://github.com/espressif/esp-idf.git /opt/esp-idf
WORKDIR /opt/esp-idf
# Install toolchains for esp32 (Xtensa) and esp32c3 (RISC-V) only
RUN ./install.sh esp32,esp32c3
# Clean up large unnecessary files to reduce image size
RUN rm -rf .git docs examples \
&& find /root/.espressif -name '*.tar.*' -delete 2>/dev/null || true
# Install Arduino-as-component for full Arduino API support in ESP-IDF builds
RUN git clone --branch 2.0.17 --depth=1 --recursive --shallow-submodules \
https://github.com/espressif/arduino-esp32.git /opt/arduino-esp32 \
&& rm -rf /opt/arduino-esp32/.git

View File

@ -136,9 +136,9 @@ COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
# Copy built frontend assets from builder stage
COPY --from=frontend-builder /app/frontend/dist /usr/share/nginx/html
# Copy and configure entrypoint script
# Copy and configure entrypoint script (fix Windows CRLF → LF)
COPY deploy/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
RUN sed -i 's/\r$//' /app/entrypoint.sh && chmod +x /app/entrypoint.sh
# ── ESP32 emulation: pre-built QEMU .so + ROM binaries ──────────────────────
# Downloaded from GitHub Release (public — no access to qemu-lcgamboa needed)