#!/bin/bash # Usage: ./run_pio_docker.sh [additional docker args] # Example: ./run_pio_docker.sh /dev/ttyUSB0 ESP_PORT="$1" shift # if [ -z "$ESP_PORT" ]; then # echo "Usage: $0 [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)