Skip to content

Modernize Docker infrastructure with Alpine 3.20 and CI/CD automation#1

Open
Petrus79 wants to merge 78 commits into
N3rdix:mainfrom
Petrus79:main
Open

Modernize Docker infrastructure with Alpine 3.20 and CI/CD automation#1
Petrus79 wants to merge 78 commits into
N3rdix:mainfrom
Petrus79:main

Conversation

@Petrus79

Copy link
Copy Markdown

Pull Request: Configurable Docker Build System with Alpine 3.20

Summary

This PR modernizes the Dockerfiles and adds a configuration system for building Docker images. It introduces:

  • Alpine 3.20 (from 3.17)
  • Python virtual environment (production best practice)
  • Configurable repositories via docker.config
  • GitHub Actions CI/CD workflow for automated multi-architecture builds
  • Updated dependencies with pinned versions

What Changed

New Files

  • docker.config - Configuration file for pyHPSU repo and Docker Hub registry
  • docker.config.example - Template documentation
  • .github/workflows/Push-Docker-Images.yml - Automated CI/CD workflow
  • CONFIGURATION.md - User guide

Modified Dockerfiles (all three architectures)

Change Reason
Alpine 3.17 → 3.20 Security patches, latest stable
System pip → venv Production standard, better isolation
Hardcoded URLs → Build args Easy customization
Removed QEMU binaries Modern buildx handles this
Updated packages Newer versions, better compatibility

Key Package Updates:

python-can: 4.1.0 → 4.6.1
paho-mqtt: 1.6.1 → 2.1.0
requests: 2.28.1 → 2.32.5
influxdb: 5.3.1 → 5.3.2

New GitHub Actions Workflow

  • Automatic builds on every push to main
  • Parallel builds for all 3 architectures
  • Configuration-driven (reads docker.config)
  • Auto-push to Docker Hub

Setup Instructions

1. Add GitHub Secrets (Required)

Go to Repository Settings → Secrets and variables → Actions

Add these two secrets:

  • DOCKER_USERNAME = your Docker Hub username
  • DOCKER_HUB = your Docker Hub personal access token

2. Configure Repository (Optional)

Edit docker.config if you need custom repositories:

PYHPSU_REPO=https://github.com/your-fork/pyHPSUmqtt.git
DOCKER_HUB_REPO=your-username/pyhpsu_mqtt

3. That's It!

Push to main branch and GitHub Actions will:

  • Build all three architectures
  • Push to Docker Hub automatically

Detailed Documentation

  • User Guide: See CONFIGURATION.md
  • Local Development: See CONFIGURATION.md → Advanced section

Testing Checklist

  • GitHub Secrets are configured
  • Push to main branch
  • Verify workflow runs in Actions tab
  • Check Docker Hub for new images

Backward Compatibility

✅ Fully compatible - default config uses original repository URLs

Updated package installation and created a Python virtual environment. Installed specific versions of Python packages inside the virtual environment.
Updated package installation and added a Python virtual environment. Changed versions of several Python packages and ensured scripts inside the virtual environment are runnable.
Comment out the line copying qemu-arm-static to /usr/bin.
Updated pip and installed specific package versions.
Removed build-essential package from Dockerfile.
Added QEMU static binary for ARM emulation and updated package installations.
Removed QEMU static binary addition and adjusted package installation.
Uncomment python3-dev installation and remove unnecessary comments.
Removed commented-out options and unused steps from the Docker image build and push workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant