Files
Maison/PacoMouseCYD/Platformio/run_pio_docker.sh
2026-02-13 08:49:53 +01:00

28 lines
775 B
Bash
Executable File

#!/bin/bash
# Usage: ./run_pio_docker.sh <ESP_PORT> [additional docker args]
# Example: ./run_pio_docker.sh /dev/ttyUSB0
ESP_PORT="$1"
shift
# if [ -z "$ESP_PORT" ]; then
# echo "Usage: $0 <ESP_PORT> [additional docker args]"
# exit 1
# fi
IMAGE="easylinux/platformio-dev:1.0"
CONTAINER="pio-dev"
PROJECT_DIR="$(pwd)"
# Run Docker container with ESP port and project directory mounted
# --device allows direct access to the ESP serial port
if [ -z "$ESP_PORT" ]; then
docker run -d --rm --name "$CONTAINER" -v "$PROJECT_DIR:/workspace" -p 8022:22 "$IMAGE" "$@"
else
docker run -d --rm --name "$CONTAINER" -v "$PROJECT_DIR:/workspace" --device "$ESP_PORT" -p 8022:22 "$IMAGE" "$@"
fi
# For advanced port forwarding, see UsingDocker.md (socat instructions)