fix: use Docker CLI with host daemon instead of buildah
Build and Push Docker Image / build-and-push (push) Has been cancelled
Build and Push Docker Image / build-and-push (push) Has been cancelled
- buildah requires user namespaces which aren't available in containers - Use Docker CLI with host's Docker socket (already mounted by runner) - Keep Alpine base and optimizations (git clone, sh shell) - Simplest solution for containerized Kubernetes runners 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
shell: sh
|
||||
run: |
|
||||
apk add --no-cache git buildah fuse-overlayfs
|
||||
apk add --no-cache git docker-cli
|
||||
|
||||
- name: Checkout code
|
||||
shell: sh
|
||||
@@ -68,21 +68,21 @@ jobs:
|
||||
- name: Login to registry
|
||||
shell: sh
|
||||
run: |
|
||||
echo "${{ secrets.PERSONAL_TOKEN }}" | buildah login --username "${{ gitea.actor }}" --password-stdin gitea.leeworks.dev
|
||||
echo "${{ secrets.PERSONAL_TOKEN }}" | docker login gitea.leeworks.dev -u "${{ gitea.actor }}" --password-stdin
|
||||
|
||||
- name: Build and push with buildah
|
||||
- name: Build and push with Docker
|
||||
shell: sh
|
||||
run: |
|
||||
echo "Building image with buildah..."
|
||||
buildah bud -t ${{ steps.tags.outputs.IMAGE_TAG }} .
|
||||
echo "Building image..."
|
||||
docker build -t ${{ steps.tags.outputs.IMAGE_TAG }} .
|
||||
|
||||
echo "Pushing image..."
|
||||
buildah push ${{ steps.tags.outputs.IMAGE_TAG }}
|
||||
docker push ${{ steps.tags.outputs.IMAGE_TAG }}
|
||||
|
||||
if [ "${{ steps.tags.outputs.PUSH_LATEST }}" = "true" ]; then
|
||||
echo "Tagging and pushing latest..."
|
||||
buildah tag ${{ steps.tags.outputs.IMAGE_TAG }} ${{ steps.tags.outputs.IMAGE_LATEST }}
|
||||
buildah push ${{ steps.tags.outputs.IMAGE_LATEST }}
|
||||
docker tag ${{ steps.tags.outputs.IMAGE_TAG }} ${{ steps.tags.outputs.IMAGE_LATEST }}
|
||||
docker push ${{ steps.tags.outputs.IMAGE_LATEST }}
|
||||
fi
|
||||
|
||||
echo "Build and push completed successfully!"
|
||||
|
||||
Reference in New Issue
Block a user