Skip to content

build: refactor docker to multi-arch buildx and add GitHub Actions workflows#61

Draft
Coooolfan wants to merge 8 commits into
ClouGence:mainfrom
Coooolfan:feat/github-action
Draft

build: refactor docker to multi-arch buildx and add GitHub Actions workflows#61
Coooolfan wants to merge 8 commits into
ClouGence:mainfrom
Coooolfan:feat/github-action

Conversation

@Coooolfan

@Coooolfan Coooolfan commented Jun 5, 2026

Copy link
Copy Markdown

Summary

  • Add CI (.github/workflows/ci.yml) and CD (.github/workflows/cd.yml). CD builds multi-arch images (linux/amd64 + linux/arm64) and pushes to GHCR on push to main.
  • Refactor package/docker/:
    • Merge x86_64/ and arm64/ into a single set of multi-arch Dockerfiles (alone.Dockerfile, console.Dockerfile, sidecar.Dockerfile).
    • Move shared scripts/config to package/docker/shared/.
    • Drop the intermediate base image; build directly FROM eclipse-temurin:21-jre-noble.
    • Install MySQL via apt (mysql-server-core-8.0) instead of the mysql.com tarball, removing per-arch download URLs and ncurses/tinfo symlink patches.
    • Rewrite build-docker.sh to use buildx. Default builds host arch with --load; --platform=all|x86_64|arm64 still emits per-arch tars + compose/k8s yml, preserving the existing publish contract.
  • Drop the obsolete --mirrors flag from package.sh (no longer needed without the tarball path).

Motivation

x86_64/ and arm64/ were near-identical duplicates (only BASE_IMAGE, MYSQL_PLATFORM, and a couple of symlinks differed); every change had to be made twice. There was also no automated image publishing. A single multi-arch Dockerfile with buildx removes the duplication, and apt removes the tarball download + symlink workarounds.

Test plan

  • CD workflow verified on the fork: https://github.com/Coooolfan/open-cdm/actions
  • Multi-arch manifests confirmed for all three images:
    • ghcr.io/coooolfan/open-cdm/clouddm-{alone,console,sidecar}:main (linux/amd64 + linux/arm64)
  • Local: cd package && ./package.sh --build --docker x86_64 produces per-arch tars — build-docker.sh's output contract is unchanged.
  • docker-publish-{china,global}.sh consume docker-{svc}-{arch}-{ver}.tar with {arch}-{ver} tags; this contract is preserved, so they are unaffected.

@CLAassistant

CLAassistant commented Jun 5, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Coooolfan Coooolfan force-pushed the feat/github-action branch 2 times, most recently from d153f44 to cdcc2e7 Compare June 8, 2026 10:22
@Coooolfan Coooolfan changed the title ci: add GitHub Actions release workflow build: refactor docker to multi-arch buildx and add GitHub Actions workflows Jun 8, 2026
Coooolfan added 8 commits June 8, 2026 19:18
Add .github/workflows/ci.yml with backend build, backend test, and frontend
check jobs; triggers on push to main, pull_request, and workflow_dispatch.
- Remove backend-build: ./gradlew test already compiles, so running buildx in a separate job was duplicate work with no extra signal.
- Drop the frontend "Unit tests" step: the repo currently has no spec/test files, and the @vue/cli-plugin-unit-jest preset additionally requires @vue/vue3-jest which is not declared. Re-enable once real tests land.
SLF4J api is declared as compileOnly, so any production class that initializes a logger (e.g. SystemUtils) fails at test time with NoClassDefFoundError: org/slf4j/LoggerFactory, cascading into ExceptionInInitializerError in unrelated FormatTest / StatementTest cases.

Add slf4j-api and slf4j-simple as testRuntimeOnly so the logger initializes and tests can also emit logs.
Add a CD workflow that on push to main (and via workflow_dispatch):

- build-tgz job: JDK 21 + Node 22.22.1, runs package.sh --build, uploads
  cgdm-{alone,console,sidecar}.tar.gz and the four deployment yml templates as
  14-day artifacts.
- docker job: matrix over [alone, console, sidecar], buildx + QEMU on the
  amd64 runner to emit linux/amd64 + linux/arm64 manifests in one go, pushes
  to ghcr.io/<owner>/<repo>/clouddm-<service> with tags main and main-<short
  sha>.

Add a unified, multi-arch Dockerfile per service under .github/docker/ that
replaces the per-arch x86_64/ and arm64/ trees for CI use:

- Base on eclipse-temurin:21-jre-noble (auto multi-arch, no hand-rolled JDK
  install).
- alone bundles MySQL 8.0 via apt mysql-server-core-8.0 + mysql-client-core-8.0
  instead of the upstream tarball, so $TARGETARCH dispatch and the libncurses
  / libtinfo softlink workarounds are no longer needed.
- shared/ holds per-service properties, init.sh and (sidecar) checker.sh,
  copied from the existing x86_64 tree (the x86_64/arm64 contents were
  identical bar trailing newlines).

The existing package/docker/{x86_64,arm64}/ trees stay in place for the local
package.sh --docker flow.
mysql-server-core-8.0 ships only the binaries; the mysql user is normally
created by the mysql-server-8.0 wrapper package, which we deliberately skip
because its postinst tries to start the daemon during docker build. Add an
explicit groupadd/useradd before chown so the apt-only install path works.
Apt-installed mysql-server-core-8.0 defaults secure-file-priv to
/var/lib/mysql-files; without that directory mysqld exits during boot.
Create it alongside /var/lib/mysql and chown to mysql.
…ildx

- merge package/docker/{x86_64,arm64}/* and .github/docker/* into single
  package/docker/{alone,console,sidecar}.Dockerfile shared across archs
- drop standalone base image; FROM eclipse-temurin:21-jre-noble directly
- install MySQL via apt (mysql-server-core-8.0) instead of tarball download,
  eliminating per-arch download URLs and ncurses/tinfo symlink workarounds
- rewrite build-docker.sh to use buildx: default builds host arch with --load
  for quick local iteration; --platform=all|x86_64|arm64 still produces
  per-arch tars and compose/k8s yml for offline distribution
- drop obsolete --mirrors flag from package.sh (apt path no longer needs
  custom Ubuntu mirrors)
- cd.yml now references package/docker/ as the single source of truth
@Coooolfan Coooolfan force-pushed the feat/github-action branch from cdcc2e7 to c6768c6 Compare June 8, 2026 11:18
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