Skip to content

Instantly share code, notes, and snippets.

@reggi
Last active August 17, 2025 00:12
Show Gist options
  • Save reggi/6d035ffabd984a29383fdb1e57ce8a69 to your computer and use it in GitHub Desktop.
Save reggi/6d035ffabd984a29383fdb1e57ce8a69 to your computer and use it in GitHub Desktop.

Build the image

docker build -t watchy-dev .

Run the container and mount CWD

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}"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment