Skip to content

Fix for calude-bun image (#9) #3

Fix for calude-bun image (#9)

Fix for calude-bun image (#9) #3

name: Build devcontainer-claude-bun
on:
push:
branches:
- master
paths:
- 'devcontainer-claude-bun/.devcontainer/Dockerfile'
- 'devcontainer-claude-bun/.devcontainer/init-firewall.sh'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: devcontainer-claude-bun
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract versions from Dockerfile
id: versions
run: |
DOCKERFILE="devcontainer-claude-bun/.devcontainer/Dockerfile"
BUN_VERSION=$(grep '^ARG BUN_VERSION=' "$DOCKERFILE" | cut -d'=' -f2)
echo "bun=$BUN_VERSION" >> $GITHUB_OUTPUT
echo "Extracted versions:"
echo " Bun: $BUN_VERSION"
- name: Generate image tags
id: tags
run: |
NAMESPACE=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
BASE_IMAGE="${{ env.REGISTRY }}/${NAMESPACE}/${{ env.IMAGE_NAME }}"
BUN_VERSION="${{ steps.versions.outputs.bun }}"
VERSION_TAG="bun${BUN_VERSION}-slim"
TAGS="${BASE_IMAGE}:latest,${BASE_IMAGE}:${VERSION_TAG}"
echo "namespace=$NAMESPACE" >> $GITHUB_OUTPUT
echo "tags=$TAGS" >> $GITHUB_OUTPUT
echo "Generated tags:"
echo "$TAGS" | tr ',' '\n'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ steps.tags.outputs.namespace }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: devcontainer-claude-bun/.devcontainer
file: devcontainer-claude-bun/.devcontainer/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.tags.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Verify image
run: |
TAGS="${{ steps.tags.outputs.tags }}"
FIRST_TAG=$(echo "$TAGS" | cut -d',' -f1)
echo "Verifying multiplatform image: $FIRST_TAG"
docker pull --platform linux/amd64 "$FIRST_TAG"
docker pull --platform linux/arm64 "$FIRST_TAG"
echo "Multiplatform image successfully built and pushed!"
echo "Tags: $TAGS"