Files
claude-hub/.github/workflows/docker-publish.yml
dependabot[bot] 4eb0c1dd5b chore(deps): bump peter-evans/dockerhub-description from 4 to 5
Bumps [peter-evans/dockerhub-description](https://github.com/peter-evans/dockerhub-description) from 4 to 5.
- [Release notes](https://github.com/peter-evans/dockerhub-description/releases)
- [Commits](https://github.com/peter-evans/dockerhub-description/compare/v4...v5)

---
updated-dependencies:
- dependency-name: peter-evans/dockerhub-description
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-06 13:00:57 +00:00

170 lines
5.7 KiB
YAML

name: Docker Build and Publish
on:
push:
branches:
- main
- master
tags:
- 'v*.*.*'
pull_request:
branches:
- main
- master
env:
DOCKER_HUB_USERNAME: ${{ vars.DOCKER_HUB_USERNAME || 'cheffromspace' }}
DOCKER_HUB_ORGANIZATION: ${{ vars.DOCKER_HUB_ORGANIZATION || 'intelligenceassist' }}
IMAGE_NAME: ${{ vars.DOCKER_IMAGE_NAME || 'claude-hub' }}
jobs:
build:
# Always use GitHub-hosted runners
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
security-events: write
steps:
- name: Runner Information
run: |
echo "Running on: ${{ runner.name }}"
echo "Runner OS: ${{ runner.os }}"
echo "Runner labels: ${{ join(runner.labels, ', ') }}"
- name: Clean workspace (fix coverage permissions)
run: |
# Fix any existing coverage file permissions before checkout
sudo find . -name "coverage" -type d -exec chmod -R 755 {} \; 2>/dev/null || true
sudo rm -rf coverage 2>/dev/null || true
- name: Checkout repository
uses: actions/checkout@v4
with:
clean: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=raw,value=nightly,enable=${{ github.ref == 'refs/heads/main' }}
# Build and test in container for PRs
- name: Build and test Docker image (PR)
if: github.event_name == 'pull_request'
run: |
# Build the test stage
docker build --target test -t ${{ env.IMAGE_NAME }}:test-${{ github.sha }} -f Dockerfile .
# Run tests in container (using default CMD from Dockerfile which runs unit tests only)
docker run --rm \
-e CI=true \
-e NODE_ENV=test \
-v ${{ github.workspace }}/coverage:/app/coverage \
${{ env.IMAGE_NAME }}:test-${{ github.sha }}
# Build production image for smoke test
docker build --target production -t ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }} -f Dockerfile .
# Smoke test
docker run --rm ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }} \
test -f /app/scripts/runtime/startup.sh && echo "✓ Startup script exists"
# Build and push for main branch
- name: Build and push Docker image
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: production
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Update Docker Hub Description
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peter-evans/dockerhub-description@v5
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.IMAGE_NAME }}
readme-filepath: ./README.dockerhub.md
short-description: ${{ github.event.repository.description }}
# Build claudecode separately
build-claudecode:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- name: Clean workspace (fix coverage permissions)
run: |
# Fix any existing coverage file permissions before checkout
sudo find . -name "coverage" -type d -exec chmod -R 755 {} \; 2>/dev/null || true
sudo rm -rf coverage 2>/dev/null || true
- name: Checkout repository
uses: actions/checkout@v4
with:
clean: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract metadata for claudecode
id: meta-claudecode
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_HUB_ORGANIZATION }}/claudecode
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=raw,value=nightly,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build and push Claude Code Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.claudecode
platforms: linux/amd64
push: true
tags: ${{ steps.meta-claudecode.outputs.tags }}
labels: ${{ steps.meta-claudecode.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Note: Fallback job removed since we're always using GitHub-hosted runners