
Docker Ci Cd
Stand up a GitHub Actions pipeline that builds multi-arch Docker images, scans them, and pushes to GHCR on merge or tag.
Install
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-docker --skill docker-ci-cdWhat is this skill?
- Complete GitHub Actions workflow for build, test, scan, and push to ghcr.io
- Multi-platform builds via QEMU and Buildx (linux/amd64 and linux/arm64)
- Branch, PR, tag, and SHA metadata tagging with docker/metadata-action
- PR builds without push; main/develop and v* tags trigger registry publish
- Uses official checkout, login, build-push, and Trivy-style security-events permissions pattern
Adoption & trust: 1 installs on skills.sh; 2 GitHub stars; 1/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Azure Kubernetesmicrosoft/azure-skills
Github Actions Docsxixu-me/skills
Deploy To Vercelvercel-labs/agent-skills
Vercel Cli With Tokensvercel-labs/agent-skills
Turborepovercel/turborepo
Docker Expertsickn33/antigravity-awesome-skills
Journey fit
Common Questions / FAQ
Is Docker Ci Cd safe to install?
skills.sh reports 1 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Docker Ci Cd
# GitHub Actions Docker Workflow # Builds, tests, scans, and pushes Docker images name: Docker Build and Push on: push: branches: [main, develop] tags: ['v*'] pull_request: branches: [main] env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: build: runs-on: ubuntu-latest permissions: contents: read packages: write security-events: write steps: - name: Checkout repository uses: actions/checkout@v4 - 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 if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=sha - name: Build and push uses: docker/build-push-action@v5 with: context: . platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master with: image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} format: 'sarif' output: 'trivy-results.sarif' - name: Upload Trivy scan results uses: github/codeql-action/upload-sarif@v2 if: always() with: sarif_file: 'trivy-results.sarif' test: runs-on: ubuntu-latest needs: build if: github.event_name != 'pull_request' steps: - name: Checkout uses: actions/checkout@v4 - name: Run container tests run: | docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \ /bin/sh -c "echo 'Container health check passed'" deploy: runs-on: ubuntu-latest needs: [build, test] if: github.ref == 'refs/heads/main' environment: production steps: - name: Deploy to production run: | echo "Deploying ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" # Add your deployment commands here # Docker CI/CD Integration Guide ## GitHub Actions ### Basic Build and Push ```yaml - name: Build and push uses: docker/build-push-action@v5 with: push: true tags: user/app:latest ``` ### Multi-Platform Build ```yaml - uses: docker/setup-qemu-action@v3 - uses: docker/setup-buildx-action@v3 - uses: docker/build-push-action@v5 with: platforms: linux/amd64,linux/arm64 ``` ### Cache Configuration ```yaml cache-from: type=gha cache-to: type=gha,mode=max ``` ## GitLab CI ### Basic Pipeline ```yaml build: image: docker:24 services: - docker:dind script: - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA . - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA ``` ## Security Scanning ### Trivy Integration ```yaml - name: Trivy scan uses: aquasecurity/trivy-action@master with: image-ref: myapp:latest format: sarif ``` ### Snyk Integration ```yaml - name: Snyk Container uses: snyk/actions/docker@master with: image: myapp:latest ``` ## Best Practices 1. **Use semantic versioning** for image tags 2. **Scan all images** before pushing 3. **Cache layers** for faster builds 4. **Multi-arch support** for ARM compatibility 5. **Sign images** for supply chain security 6. *