c5645c0f2b
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
70 lines
1.9 KiB
YAML
70 lines
1.9 KiB
YAML
name: Build Docker Image for Raspberry Pi
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
- develop
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
with:
|
|
platforms: linux/arm/v6,linux/arm/v7,linux/arm64
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
${{ secrets.DOCKER_USERNAME }}/ha-voltronic-mqtt
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Login to Docker Hub
|
|
if: github.event_name != 'pull_request' && secrets.DOCKER_USERNAME != ''
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.multiarch
|
|
platforms: linux/arm/v6,linux/arm/v7,linux/arm64
|
|
push: ${{ github.event_name != 'pull_request' && secrets.DOCKER_USERNAME != '' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
BUILD_DATE=${{ github.event.repository.updated_at }}
|
|
VERSION=${{ steps.meta.outputs.version }}
|
|
VCS_REF=${{ github.sha }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: Image digest
|
|
run: echo ${{ steps.meta.outputs.tags }}
|