Skip to main content
Settings
Search
Appearance
Theme Mode
About
Jekyll v3.10.0
Environment Production
Last Build
2026-05-19 04:06 UTC
Current Environment Production
Build Time May 19, 04:06
Jekyll v3.10.0
Build env (JEKYLL_ENV) production
Page Location
Page Info
Layout default
Collection docs
Path _docs/development/docker-publishing.md
URL /docs/development/docker-publishing/
Date 2026-05-19
Theme Skin
SVG Backgrounds
Layer Opacity
0.6
0.04
0.08

Local Docker Publishing Pipeline

You can build and publish the jekyll-theme-zer0 gem entirely inside a Docker container. This mirrors the CI release path exactly, avoiding version-skew issues caused by different host Ruby environments.

Why Run Releases in Docker?

Problem Docker solution
Host Ruby version mismatch Container uses the same Ruby as CI
Polluted gem environment Clean container discarded after run
“Works on my machine” Exact CI environment reproduced locally
Key material leaks Credentials injected via env vars, never stored

Compose Files

File Purpose
docker-compose.publish.yml Builds and pushes the Docker image to a registry
docker-compose.prod.yml Production deployment with pinned image tags

Releasing the Gem Locally

The recommended approach is the unified release script, which handles everything:

./scripts/bin/release patch    # or minor / major

This script:

  1. Analyzes commits since the last tag to confirm the bump type
  2. Updates lib/jekyll-theme-zer0/version.rb
  3. Runs validation (./scripts/bin/validate)
  4. Builds the gem (gem build jekyll-theme-zer0.gemspec)
  5. Creates a git tag and pushes
  6. Publishes to RubyGems (gem push)

Pass --dry-run to preview without publishing:

./scripts/bin/release patch --dry-run

Running in a Docker Container

To run the release inside a Docker container manually:

# Start a clean Jekyll container
docker compose -f docker-compose.yml run --rm jekyll bash

# Inside the container:
./scripts/bin/release patch

Or with the publish compose file:

docker compose -f docker-compose.yml \
               -f docker-compose.publish.yml \
               build publish

Environment Variables

Set credentials in .env (never commit this file):

RUBYGEMS_API_KEY=rubygems_...
GITHUB_TOKEN=ghp_...
DOCKER_IMAGE=amrabdel/zer0-mistakes
IMAGE_TAG=latest

The .env file is already in .gitignore.

CI Pipeline Equivalent

GitHub Actions runs the same release pipeline automatically on version tags:

# .github/workflows/release.yml (simplified)
- name: Build gem
  run: gem build jekyll-theme-zer0.gemspec

- name: Publish to RubyGems
  run: gem push jekyll-theme-zer0-$.gem
  env:
    GEM_HOST_API_KEY: $

Troubleshooting

“Invalid API key”

Set RUBYGEMS_API_KEY in your shell or .env file:

export RUBYGEMS_API_KEY=$(cat ~/.gem/credentials | grep rubygems_api_key | cut -d' ' -f2)

Gem already published at that version

Bump the version and re-run. RubyGems does not allow overwriting a published version.

Docker build fails

docker compose down -v
docker compose build --no-cache

See also

  • [[Development]]
  • [[Docker]]
  • [[Release Management]]