Aggiunta configurazione tramite variabili d'ambiente e fix Docker Hub secrets
Build Docker Image for Raspberry Pi / build-and-push (push) Failing after 23s

- Aggiunto supporto ENV variables nel Dockerfile:
  * INVERTER_DEVICE, MQTT_SERVER, MQTT_PORT, MQTT_TOPIC
  * MQTT_DEVICENAME, MQTT_USERNAME, MQTT_PASSWORD
  * FORCE_DISCOVERY, SKIP_DISCOVERY
- Implementata funzione update_mqtt_config() in entrypoint.sh
  * Aggiorna automaticamente mqtt.json da ENV variables all'avvio
  * Backup automatico configurazione originale
- Fix workflow Docker build:
  * Login Docker Hub solo se secrets configurati
  * Push solo se secrets disponibili (evita errori CI/CD)
  * Build funziona anche senza secrets (utile per test locali)
- Aggiornato docker-compose.yml con esempio ENV variables
- Creata documentazione completa DOCKER_SETUP.md:
  * Guida configurazione variabili d'ambiente
  * Esempi docker-compose e docker run
  * Guida configurazione secrets Gitea
  * Troubleshooting e health check

Ora è possibile configurare completamente il container senza modificare file
This commit is contained in:
Pi Developer
2026-01-31 16:21:42 +01:00
parent 547537e761
commit c5645c0f2b
5 changed files with 264 additions and 4 deletions
+11
View File
@@ -24,6 +24,17 @@ ADD config/ /etc/inverter/
RUN cd /opt/inverter-cli && \
mkdir bin && cmake . && make
# Environment variables for runtime configuration
ENV INVERTER_DEVICE="/dev/ttyUSB0" \
MQTT_SERVER="192.168.1.37" \
MQTT_PORT="1883" \
MQTT_TOPIC="homeassistant" \
MQTT_DEVICENAME="voltronic" \
MQTT_USERNAME="" \
MQTT_PASSWORD="" \
FORCE_DISCOVERY="false" \
SKIP_DISCOVERY="false"
HEALTHCHECK \
--interval=30s \
--timeout=10s \