Implement docker-images.yml workflow: build and push service images with OIDC login
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 17h 7m
- Merged PRs (30d)
- 358
Description
## Motivation
Core deliverable of the epic: a reusable workflow that bakes the service images from `docker/backend.ai-*` dockerfiles (seven including the agent, BA-7271) and pushes them to Docker Hub using OIDC — no stored registry credentials.
## Details
New `.github/workflows/docker-images.yml` with `on: [workflow_call, workflow_dispatch]` (same shape as `sbom.yml`):
**prepare job**
1. Build the matrix via the shared dockerfile-discovery script (BA-7267) — the agent dockerfile from BA-7271 is picked up automatically once it lands.
1. Resolve `PYTHON_VERSION` from `pants.toml` and normalized `PKGVER` from `VERSION` (reuse the normalization in `scripts/build-wheels.sh`).
**build-push job** (matrix over the service images)
1. `environment: deploy-to-dockerhub`; `permissions: contents: read, id-token: write`.
1. Checkout, then download the `wheels` artifact into `dist/` (the dockerfiles install wheels from `dist/` + root `requirements.txt`; build context = repo root).
1. `docker/setup-qemu-action` + `docker/setup-buildx-action`; build `linux/amd64,linux/arm64` (aarch64 wheels are already produced by `scripts/build-wheels.sh`).
1. **OIDC login**: `docker/login-action@v4` (≥ 4.5.0) with `username: lablup`, no password, `env: DOCKERHUB_OIDC_CONNECTIONID: ${{ vars.DOCKERHUB_OIDC_CONNECTION_ID `}}.
1. `docker/metadata-action` for tags: the version tag always; `latest` only when `scripts/determine-release-type.py` says the version is final (do not re-implement prerelease detection).
1. `docker/build-push-action` with `push: true`, build args `PYTHON_VERSION` / `PKGVER`, and provenance + SBOM attestations enabled.
Guardrails (`.github/AGENTS.md`): pin all third-party actions to commit SHAs with `# vN` comments; never interpolate `${{ `}} into shell — pass values via `env:` and quoted arguments; any multi-line logic goes to `scripts/`.
Depends on: BA-7266, BA-7267. The workflow does not hard-depend on BA-7271 — the matrix builds whatever service dockerfiles exist, so the agent image joins automatically when BA-7271 merges.
## Success Criteria
- [ ] `workflow_dispatch` run on a tag builds and pushes all service images (seven once BA-7271 lands) multi-arch with correct tags.
- [ ] No registry secret exists in the repository; login succeeds purely via OIDC.
- [ ] Workflow passes actionlint / matches existing workflow conventions.
JIRA Issue: BA-7268
Contributor guide
Research direction
Start with .github/workflows/sbom.yml and the shared dockerfile-discovery script, then read scripts/build-wheels.sh and scripts/determine-release-type.py for version and release handling. Implement .github/workflows/docker-images.yml around the stated prepare and build-push jobs, following .github/AGENTS.md. Done means actionlint passes and a tag dispatch builds and pushes the discovered service images with multi-architecture tags using OIDC and no registry secret.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, github-actions, python
- Domain
- ci-cd, cloud, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100