Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • tag releases to main with version numbers
  • speed up docker builds

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Dec 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docs Ready Ready Preview, Comment Dec 12, 2025 10:22pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 12, 2025

Greptile Overview

Greptile Summary

This PR implements automated version tagging for releases and optimizes Docker build performance. When commits to main branch follow the pattern v{major}.{minor}.{patch}: ..., the CI workflow automatically creates version-tagged Docker images alongside the standard latest and SHA-based tags. Docker build times are reduced through BuildKit cache mounts for Bun package installations and an expanded .dockerignore that excludes unnecessary files from the build context.

Key changes:

  • Added detect-version job that extracts version from commit messages using regex pattern ^(v[0-9]+\.[0-9]+\.[0-9]+):
  • Version tags are created for all three Docker images (app, migrations, realtime) on both AMD64 and ARM64 architectures
  • Multi-arch manifests include version tags when releases are detected
  • BuildKit cache mounts (--mount=type=cache,id=bun-cache) speed up bun install operations
  • Added --frozen-lockfile flag to ensure deterministic builds
  • Expanded .dockerignore from 11 to 67 lines, excluding build artifacts, IDE files, and test files

Confidence Score: 4/5

  • This PR is safe to merge with minor considerations for the regex pattern matching
  • The changes are well-structured and follow Docker best practices. BuildKit cache mounts and frozen lockfiles are standard optimizations. The version detection logic is sound, though it only triggers on exact commit message format. The .dockerignore expansion is comprehensive and safe. The only minor consideration is ensuring the version commit message format is documented for the team.
  • .github/workflows/ci.yml - verify the commit message format v{major}.{minor}.{patch}: is documented for the release process

Important Files Changed

File Analysis

Filename Score Overview
.dockerignore 5/5 Expanded .dockerignore to exclude unnecessary files from Docker build context, reducing context size and speeding up builds
.github/workflows/ci.yml 4/5 Added version detection and tagging logic for release commits, creates version tags for Docker images on main branch
docker/app.Dockerfile 5/5 Added BuildKit cache mounts and --frozen-lockfile flag to speed up builds and ensure reproducibility

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub (main)
    participant CI as CI Workflow
    participant DV as detect-version
    participant TB as test-build
    participant AMD as build-amd64
    participant ARM as build-ghcr-arm64
    participant ECR as AWS ECR
    participant GHCR as GitHub Container Registry
    participant MF as create-ghcr-manifests

    Dev->>GH: Push commit (e.g., "v0.5.24: new feature")
    GH->>CI: Trigger CI workflow
    
    par Run Tests and Detect Version
        CI->>TB: Run tests and build
        CI->>DV: Extract version from commit message
        DV->>DV: Check if commit matches ^(v[0-9]+\.[0-9]+\.[0-9]+):
        alt Version commit on main
            DV->>DV: Set is_release=true, version=v0.5.24
        else Not a version commit
            DV->>DV: Set is_release=false
        end
    end

    TB-->>CI: Tests passed ✓
    DV-->>CI: Version detected (if applicable)

    par Build AMD64 and ARM64
        CI->>AMD: Build AMD64 images (3 services)
        Note over AMD: Uses BuildKit cache mounts<br/>for faster bun install
        AMD->>ECR: Push latest/staging + SHA tags
        alt Main branch
            AMD->>GHCR: Push latest-amd64 + SHA-amd64
            alt is_release=true
                AMD->>GHCR: Push v0.5.24-amd64
            end
        end
        
        CI->>ARM: Build ARM64 images (3 services)
        Note over ARM: Uses BuildKit cache mounts<br/>for faster bun install
        ARM->>GHCR: Push latest-arm64 + SHA-arm64
        alt is_release=true
            ARM->>GHCR: Push v0.5.24-arm64
        end
    end

    AMD-->>CI: AMD64 builds complete
    ARM-->>CI: ARM64 builds complete

    CI->>MF: Create multi-arch manifests
    MF->>GHCR: Create manifest for latest tag
    MF->>GHCR: Create manifest for SHA tag
    alt is_release=true
        MF->>GHCR: Create manifest for v0.5.24 tag
    end
    MF-->>CI: Manifests created ✓
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 323e035 into staging Dec 12, 2025
10 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/sha branch December 12, 2025 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants