docker build -t watchy-dev .
docker run --rm -it
--device=/dev/ttyACM0
--privileged
-v "$(pwd)":/home/dockeruser/app
watchy-dev
FROM debian:bookworm | |
ENV DEBIAN_FRONTEND=noninteractive | |
# Install dependencies | |
RUN apt-get update && apt-get install -y \ | |
curl \ | |
wget \ | |
sudo \ | |
unzip \ | |
gcc \ | |
make \ | |
python3 \ | |
python3-pip \ | |
usbutils \ | |
udev \ | |
git \ | |
xz-utils \ | |
libarchive-tools | |
# Create a non-root user | |
RUN useradd -m dockeruser && \ | |
echo "dockeruser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | |
USER dockeruser | |
WORKDIR /home/dockeruser/app | |
# Install Arduino CLI | |
RUN wget https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.deb && \ | |
sudo apt-get install -y ./arduino-cli_latest_Linux_64bit.deb && \ | |
rm arduino-cli_latest_Linux_64bit.deb | |
# Setup Arduino CLI with ESP32 support | |
RUN arduino-cli config init && \ | |
arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json && \ | |
arduino-cli core update-index && \ | |
arduino-cli core install esp32:esp32 && \ | |
arduino-cli lib install Watchy | |
# Auto compile and upload, with configurable port | |
ENTRYPOINT ["bash", "-c", "\ | |
arduino-cli compile \ | |
--fqbn esp32:esp32:esp32s3 \ | |
--build-property=build.flash_size=8MB \ | |
--build-property=build.partitions=default_8MB \ | |
--build-property=upload.maximum_size=3342336 && \ | |
arduino-cli upload \ | |
--fqbn esp32:esp32:esp32s3 \ | |
-p ${TTY:-/dev/ttyACM0}"] |