Skip to content

chore: modernize Dockerfile and Docker release workflow#13

Merged
t0mer merged 5 commits into
masterfrom
docker
Jun 1, 2026
Merged

chore: modernize Dockerfile and Docker release workflow#13
t0mer merged 5 commits into
masterfrom
docker

Conversation

@t0mer

@t0mer t0mer commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Switches the base image from ubuntu:24.10 to python:3.12-slim for a
    smaller, purpose-built Python image
  • Moves speedtest-cli from a fragile wget install to a standard pip
    dependency
  • Replaces a stale, partially-broken GitHub Actions workflow with a modern,
    maintainable one

Changes

Dockerfile

  • Base image changed from ubuntu:24.10 to python:3.12-slim — Python is
    pre-installed, no manual python3/pip3 setup needed
  • Removed the wget step that downloaded speedtest.py to a hardcoded
    python3.12 site-packages path (fragile and redundant)
  • Dropped apt installs of python3, python3-pip, wget, and
    speedtest-cli — now handled by pip or no longer needed
  • Kept curl (required by ip_command at runtime)
  • Consolidated ENV declarations and added PIP_NO_CACHE_DIR /
    PIP_DISABLE_PIP_VERSION_CHECK

requirements.txt

  • Added speedtest-cli — replaces the old wget-based install

.dockerignore

  • Added to keep the build context lean (excludes .git, screenshots,
    dev scripts, config/, etc.)

scripts/next-version.sh

  • New script that computes a YYYY.M.PATCH date-based version from git
    tags, used by the updated workflow

.github/workflows/docker.yml

  • Bumped all action versions to current majors:
    checkout@v2→v4, setup-qemu@v1→v3, setup-buildx@v1→v3,
    login-action@v1→v3, build-push-action@v2→v5
  • Replaced deprecated ::set-output with >> "$GITHUB_OUTPUT"
  • Fixed image name: techblog/dockerbot-trainertechblog/dockerbot
  • Removed release: published trigger — workflow_dispatch only, with
    an optional version input (auto-computed via next-version.sh if blank)
  • Added contents: write permission and fetch-depth: 0 for tag creation
  • Workflow now tags the commit and pushes the tag as part of the release step

Test plan

  • docker build . completes without error on a clean checkout
  • speedtest-cli is available in the built image (docker run --rm techblog/dockerbot speedtest-cli --version)
  • Triggering the workflow with no version input auto-computes
    YYYY.M.PATCH and pushes a tag
  • Image is published to Docker Hub as techblog/dockerbot:latest and
    techblog/dockerbot:<version>
  • Multi-arch build succeeds for linux/amd64, linux/arm64,
    linux/arm/v7

Copilot AI review requested due to automatic review settings June 1, 2026 23:21
@t0mer t0mer merged commit 5f7eb41 into master Jun 1, 2026
1 of 2 checks passed
@t0mer

t0mer commented Jun 1, 2026

Copy link
Copy Markdown
Owner Author

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the project’s container build and release pipeline by switching to a slimmer Python base image, installing speedtest-cli via pip, and replacing the legacy Docker publish workflow with a workflow-dispatch driven, tag-producing build.

Changes:

  • Update Docker image base to python:3.12-slim, simplify system deps, and install Python deps via pip.
  • Add speedtest-cli to requirements.txt (replacing the prior wget-based install approach).
  • Introduce a next-version.sh helper and update the GitHub Actions workflow to compute versions, create git tags, and build/push multi-arch images.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Dockerfile Switches to Python slim image; simplifies runtime deps (keeps curl) and installs requirements via pip.
requirements.txt Adds speedtest-cli as a pip dependency.
scripts/next-version.sh New helper to compute YYYY.M.PATCH style versions from existing tags.
.github/workflows/docker.yml Replaces legacy workflow with workflow_dispatch + version resolution, tag creation, and multi-arch build/push.
.dockerignore Adds a dockerignore to reduce build context size.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +21 to +30
- name: Resolve version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="$(./scripts/next-version.sh)"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"

Comment on lines +31 to +37
- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "${{ steps.version.outputs.version }}"
git push origin "${{ steps.version.outputs.version }}"

Comment thread scripts/next-version.sh
Comment on lines +3 to +6
TODAY="$(date +%Y.%-m)"
LATEST="$(git tag --list "${TODAY}.*" 2>/dev/null | sort -V | tail -1)"
if [ -z "$LATEST" ]; then echo "${TODAY}.0";
else PATCH="${LATEST##*.}"; echo "${TODAY}.$((PATCH + 1))"; fi
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.

2 participants