Skip to content

ci(server): publish mem0-api-server Docker image with semver tags on release#5341

Open
shivamtyagi18 wants to merge 1 commit into
mem0ai:mainfrom
shivamtyagi18:feat/server-docker-publish-workflow
Open

ci(server): publish mem0-api-server Docker image with semver tags on release#5341
shivamtyagi18 wants to merge 1 commit into
mem0ai:mainfrom
shivamtyagi18:feat/server-docker-publish-workflow

Conversation

@shivamtyagi18
Copy link
Copy Markdown

Closes #5340

Summary

Adds a GitHub Actions workflow that publishes the server Docker image (server/Dockerfile) to Docker Hub with semver-aligned tags on each GitHub release event.

File added: .github/workflows/server-docker-cd.yml (62 lines)
File modified: server/README.md (+12 lines, new "Docker image" section)

What this gives downstream users on each release

Tag Notes
mem0/mem0-api-server:vX.Y.Z Exact pin — recommended for production (immutable, audit-friendly)
mem0/mem0-api-server:vX.Y Minor channel — auto-update on patch releases
mem0/mem0-api-server:vX Major channel — auto-update on minor + patch releases
mem0/mem0-api-server:latest Moves with each release; convenient for dev, not production-safe

Motivation

Discussed in detail at #5340. Short version: Docker Hub currently has a single mutable :latest tag (last pushed 2025-09-10, 264 days as of opening). Production K8s deployments need immutable pinned tags for rollback safety, audit trails, and vulnerability scanning baselines. This workflow closes that gap without changing any runtime behavior.

Implementation notes

  • Trigger: release.published (same pattern as the existing cd.yml PyPI publish) + workflow_dispatch for manual re-publish (with optional tag input).
  • Multi-platform: builds linux/amd64 + linux/arm64 via Buildx + QEMU. Drop the linux/arm64 line if you'd rather start amd64-only.
  • Layer cache: GitHub-hosted (cache-from: type=gha / cache-to: type=gha,mode=max). No external infra to set up; subsequent builds are fast.
  • Fork-safe: the if: github.repository == 'mem0ai/mem0' guard prevents the workflow from running on forks (where it would fail confusingly on missing secrets). Manual workflow_dispatch is allowed everywhere for testing.
  • Filename: server-docker-cd.yml rather than reusing cd.yml so the existing PyPI publish flow stays untouched.

What you'd configure post-merge

Two repo-level GitHub Actions secrets:

  • DOCKERHUB_USERNAME — Docker Hub account that owns the mem0/mem0-api-server repo
  • DOCKERHUB_TOKEN — Docker Hub access token with push scope

Until those are configured the workflow stays dormant (won't run on release events because the guard short-circuits early). No risk to existing flows.

What I'm explicitly NOT touching

  • server/Dockerfile — your existing Dockerfile is fine. This PR only adds a publish workflow around it.
  • server/docker-compose.yml — local-dev pattern stays as-is.
  • Existing cd.yml (PyPI publish) — completely separate.
  • No new env vars, no runtime behavior changes.

Optional follow-ups (NOT in this PR, happy to file as a separate PR if you want any of them)

  • Cosign signing for supply-chain integrity (~10 lines added)
  • SBOM publishing via docker/build-push-action's sbom: true (~1 line)
  • PR preview builds (build, don't push, on PR for CI smoke testing)

Test plan

  • YAML parses correctly (verified via gh actions-cli validate-equivalent locally)
  • Workflow file follows existing repo conventions (release-triggered, similar shape to cd.yml)
  • Maintainer review
  • After merge + secrets configured, next release auto-publishes tagged images

If you'd prefer a different shape (different workflow filename, no arm64, different tag scheme, etc.), happy to iterate.

Companion

This is the second of two issues split from the original #5337/#5339 thread. The first half (MEM0_CONFIG_PATH for K8s ConfigMap-driven config) is at #5338.


Thanks again for mem0! 🙏

…release

Adds a GitHub Actions workflow that builds and publishes the server
Docker image (server/Dockerfile) to Docker Hub on each GitHub release
event, producing semver-aligned tags for downstream pinning:

- mem0/mem0-api-server:vX.Y.Z     (exact pin — production-safe)
- mem0/mem0-api-server:vX.Y       (minor channel)
- mem0/mem0-api-server:vX         (major channel)
- mem0/mem0-api-server:latest     (moves with each release)

Motivation: today only a single mutable `:latest` tag is published
(last pushed 2025-09-10 as of opening), so Kubernetes / production
deployments have no immutable target to pin against. This workflow
follows the same release-triggered pattern as the existing
PyPI publish workflow (cd.yml).

Implementation:
- Multi-platform build (linux/amd64 + linux/arm64) via Buildx + QEMU
- GitHub-hosted layer cache (cache-from/to: type=gha) for fast
  subsequent builds without external infra
- Fork-safe: workflow runs only on the canonical mem0ai/mem0 repo or
  via manual workflow_dispatch — forks won't fail confusingly on
  missing secrets
- workflow_dispatch input lets maintainers re-publish a specific tag
  manually if needed (e.g. after a hotfix or secret rotation)

Required secrets (configured by maintainers post-merge):
- DOCKERHUB_USERNAME — the bot/account that owns mem0/mem0-api-server
- DOCKERHUB_TOKEN    — Docker Hub access token with push scope

Until the secrets are configured the workflow stays dormant; the file
just sits in repo. No risk to existing flows.

Also adds a brief "Docker image" section to server/README.md
documenting the tag scheme and recommending semver pinning over
:latest for production use.

See mem0ai#5340 for the broader rationale and discussion.
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.

Publish Docker image with semver tags on each release (mem0-api-server)

1 participant