pi_pico/color_switcher/docker-compose.yml
Mohamed Salem ce5f63b35b Move project into color_switcher/ subfolder
Restructure repo so the root contains project folders. This allows
adding more Pico projects (e.g., another_project/) alongside
color_switcher/ in the same repository. All internal paths are
relative and unchanged — cd into color_switcher/ to build/flash.
2026-04-13 03:39:56 +02:00

38 lines
2.0 KiB
YAML

# ============================================================================
# Docker Compose configuration for the Raspberry Pi Pico firmware project
# ============================================================================
# The container is configured to be long-running (sleep infinity) rather than
# running the build on startup. This lets the same container be used for:
# 1. One-shot builds from the host
# 2. Interactive shells (docker compose exec) for debugging
# 3. VS Code Dev Containers - which expects the container to stay alive
# so it can attach clangd, install extensions, and open a terminal
#
# Usage:
# docker compose build - (re)build the image after Dockerfile changes
# docker compose up -d - start the persistent container in the background
# docker compose exec pico-build bash - shell into the running container
# docker compose run --rm pico-build bash build.sh - one-shot firmware build, container removed after
# docker compose down - stop and remove the persistent container
# ============================================================================
services:
pico-build:
# Build the image from the Dockerfile in the project root
build: .
# Mount the project source code into the container's working directory.
# This lets the container read our source files and write build artifacts
# (including the .uf2 firmware file) back to the host filesystem.
volumes:
- .:/project
# Keep the container alive indefinitely. We intentionally do NOT run the
# build on startup - `sleep infinity` lets the container stay up so it can
# be used as a persistent dev environment (VS Code Dev Containers, shells
# via `docker compose exec`, etc.). To trigger a build, run:
# docker compose run --rm pico-build bash build.sh
# or, if you're already inside the container:
# bash build.sh
command: sleep infinity