diff --git a/Dockerfile.standalone b/Dockerfile.standalone index 2c314fa..cb166fe 100644 --- a/Dockerfile.standalone +++ b/Dockerfile.standalone @@ -88,7 +88,8 @@ RUN arduino-cli config init \ && arduino-cli core update-index \ && arduino-cli core install arduino:avr \ && arduino-cli core install rp2040:rp2040 \ - && arduino-cli core install esp32:esp32 + && arduino-cli core install esp32:esp32 \ + && cp -a /root/.arduino15 /root/.arduino15-base WORKDIR /app diff --git a/deploy/entrypoint.sh b/deploy/entrypoint.sh index 66ba3fc..25afb78 100644 --- a/deploy/entrypoint.sh +++ b/deploy/entrypoint.sh @@ -1,6 +1,15 @@ #!/bin/bash set -e +# Seed arduino-cli data into the mounted volume if it's empty +# (first deploy or after volume prune). The base cores (avr, rp2040, esp32) +# were installed at build time and saved to /root/.arduino15-base. +if [ ! -f /root/.arduino15/arduino-cli.yaml ]; then + echo "📦 Seeding arduino-cli cores into volume..." + cp -a /root/.arduino15-base/* /root/.arduino15/ 2>/dev/null || \ + cp -a /root/.arduino15-base/. /root/.arduino15/ +fi + # Start FastAPI backend in the background on port 8001 echo "🚀 Starting Velxio Backend..." uvicorn app.main:app --host 127.0.0.1 --port 8001 & diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 5dc02db..36ea92a 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -14,9 +14,13 @@ services: - DATA_DIR=/app/data volumes: - ./data:/app/data + - arduino-libs:/root/.arduino15 healthcheck: test: ["CMD", "curl", "-f", "http://localhost/health"] interval: 30s timeout: 10s retries: 3 start_period: 90s + +volumes: + arduino-libs: