forked from claude-did-this/claude-hub
- Update workflow to use intelligenceassist/claude-hub instead of claude-github-webhook - Update all README references to use new image name - Update Docker Hub documentation with correct image names and links
127 lines
4.1 KiB
YAML
127 lines
4.1 KiB
YAML
name: Docker Build and Publish
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
tags:
|
|
- 'v*.*.*'
|
|
paths:
|
|
- 'Dockerfile*'
|
|
- 'package*.json'
|
|
- '.github/workflows/docker-publish.yml'
|
|
- 'src/**'
|
|
- 'scripts/**'
|
|
- 'claude-config*'
|
|
|
|
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:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- 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: |
|
|
# For semantic version tags (v0.1.0 -> 0.1.0, 0.1, 0, latest)
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: ${{ github.event_name == 'pull_request' && 'linux/amd64' || 'linux/amd64,linux/arm64' }}
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: |
|
|
type=gha,scope=publish-main
|
|
type=local,src=/tmp/.buildx-cache-main
|
|
cache-to: |
|
|
type=gha,mode=max,scope=publish-main
|
|
type=local,dest=/tmp/.buildx-cache-main-new,mode=max
|
|
|
|
- name: Update Docker Hub Description
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
uses: peter-evans/dockerhub-description@v4
|
|
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 }}
|
|
|
|
# Additional job to build and push the Claude Code container
|
|
build-claudecode:
|
|
runs-on: ubuntu-latest
|
|
# Only run when not a pull request
|
|
if: github.event_name != 'pull_request'
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- 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=ref,event=branch,suffix=-staging
|
|
type=semver,pattern={{version}}
|
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
|
|
- 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,scope=publish-claudecode
|
|
type=local,src=/tmp/.buildx-cache-claude
|
|
cache-to: |
|
|
type=gha,mode=max,scope=publish-claudecode
|
|
type=local,dest=/tmp/.buildx-cache-claude-new,mode=max |