From b894814df08e7c293379100534685266222da336 Mon Sep 17 00:00:00 2001 From: Milind Srivastava Date: Sun, 8 Mar 2026 13:27:15 -0400 Subject: [PATCH 1/3] Modified CI to build packages based on tagsl --- .github/workflows/docker.yml | 100 ++++++++++++++---- .../operations/publishing-docker-images.md | 47 ++++++++ 2 files changed, 124 insertions(+), 23 deletions(-) create mode 100644 docs/03-how-to-guides/operations/publishing-docker-images.md diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ad39f01..bcd4faf 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,21 +2,23 @@ name: Docker Builds on: push: - branches: [ main ] - paths: - - 'asap-common/installation/**' - - 'asap-planner/**' - - 'asap-tools/queriers/prometheus-client/**' - - '.github/workflows/docker.yml' + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' pull_request: - branches: [ main ] + branches: [main] paths: - 'asap-common/installation/**' - 'asap-planner/**' + - 'asap-sketch-ingest/**' + - 'asap-query-engine/**' - 'asap-tools/queriers/prometheus-client/**' - '.github/workflows/docker.yml' workflow_dispatch: +permissions: + packages: write + contents: read + jobs: build-images: runs-on: ubuntu-latest @@ -27,31 +29,83 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + # --- Base image (Python, fast) --- - name: Build base image - working-directory: asap-common/installation run: | docker build \ -t sketchdb-base:latest \ - -f Dockerfile \ - .. + -t ghcr.io/projectasap/asap-base:${{ github.ref_name }} \ + -t ghcr.io/projectasap/asap-base:latest \ + -f asap-common/installation/Dockerfile \ + asap-common - - name: Test base image + - name: Push base image + if: startsWith(github.ref, 'refs/tags/') run: | - docker run --rm sketchdb-base:latest python --version - docker run --rm sketchdb-base:latest pip list + docker push ghcr.io/projectasap/asap-base:${{ github.ref_name }} + docker push ghcr.io/projectasap/asap-base:latest - - name: Build Controller Docker image - working-directory: asap-planner + # --- Planner (Python, depends on base) --- + - name: Build planner image run: | docker build \ - -t sketchdb-controller:latest \ - -f Dockerfile \ - . + -t ghcr.io/projectasap/asap-planner:${{ github.ref_name }} \ + -t ghcr.io/projectasap/asap-planner:latest \ + -f asap-planner/Dockerfile \ + asap-planner + + - name: Push planner image + if: startsWith(github.ref, 'refs/tags/') + run: | + docker push ghcr.io/projectasap/asap-planner:${{ github.ref_name }} + docker push ghcr.io/projectasap/asap-planner:latest - - name: Build PrometheusClient Docker image - working-directory: asap-tools/queriers/prometheus-client + # --- Sketch Ingest (Python, depends on base) --- + - name: Build sketch-ingest image run: | docker build \ - -t sketchdb-prometheus-client:latest \ - -f Dockerfile \ - . + -t ghcr.io/projectasap/asap-sketch-ingest:${{ github.ref_name }} \ + -t ghcr.io/projectasap/asap-sketch-ingest:latest \ + -f asap-sketch-ingest/Dockerfile \ + asap-sketch-ingest + + - name: Push sketch-ingest image + if: startsWith(github.ref, 'refs/tags/') + run: | + docker push ghcr.io/projectasap/asap-sketch-ingest:${{ github.ref_name }} + docker push ghcr.io/projectasap/asap-sketch-ingest:latest + + # --- Prometheus Client (Python, depends on base) --- + - name: Build prometheus-client image + run: | + docker build \ + -t ghcr.io/projectasap/asap-prometheus-client:${{ github.ref_name }} \ + -t ghcr.io/projectasap/asap-prometheus-client:latest \ + -f asap-tools/queriers/prometheus-client/Dockerfile \ + asap-tools/queriers/prometheus-client + + - name: Push prometheus-client image + if: startsWith(github.ref, 'refs/tags/') + run: | + docker push ghcr.io/projectasap/asap-prometheus-client:${{ github.ref_name }} + docker push ghcr.io/projectasap/asap-prometheus-client:latest + + # --- Query Engine (Rust, slow — uses GHCR layer cache) --- + - name: Build and push query-engine + uses: docker/build-push-action@v6 + with: + context: . + file: asap-query-engine/Dockerfile + push: ${{ startsWith(github.ref, 'refs/tags/') }} + tags: | + ghcr.io/projectasap/asap-query-engine:${{ github.ref_name }} + ghcr.io/projectasap/asap-query-engine:latest + cache-from: type=registry,ref=ghcr.io/projectasap/asap-query-engine:buildcache + cache-to: type=registry,ref=ghcr.io/projectasap/asap-query-engine:buildcache,mode=max diff --git a/docs/03-how-to-guides/operations/publishing-docker-images.md b/docs/03-how-to-guides/operations/publishing-docker-images.md new file mode 100644 index 0000000..230cc43 --- /dev/null +++ b/docs/03-how-to-guides/operations/publishing-docker-images.md @@ -0,0 +1,47 @@ +# Publishing Docker Images to GHCR + +Docker images are published to `ghcr.io/projectasap/` by pushing a version tag. Nothing is published on regular commits or PRs. + +## How to publish a release + +```bash +git tag v0.2.0 +git push origin v0.2.0 +``` + +That's it. GitHub Actions will build and push all images tagged as both `v0.2.0` and `latest`. + +## Images published from this repo + +| Image | Source | +|---|---| +| `ghcr.io/projectasap/asap-base` | `asap-common/installation/` | +| `ghcr.io/projectasap/asap-planner` | `asap-planner/` | +| `ghcr.io/projectasap/asap-sketch-ingest` | `asap-sketch-ingest/` | +| `ghcr.io/projectasap/asap-query-engine` | `asap-query-engine/` | +| `ghcr.io/projectasap/asap-prometheus-client` | `asap-tools/queriers/prometheus-client/` | + +The arroyo image (`ghcr.io/projectasap/asap-arroyo`) is published separately from the [ProjectASAP/arroyo](https://github.com/ProjectASAP/arroyo) repo using the same process. + +## Coordinating with the arroyo repo + +The quickstart docker-compose pins specific image versions. When cutting a release, tag both repos with the same version and update the quickstart compose file to reference the new tags. + +```bash +# In this repo +git tag v0.2.0 && git push origin v0.2.0 + +# In ProjectASAP/arroyo +git tag v0.2.0 && git push origin v0.2.0 +``` + +Then update the image tags in `asap-quickstart/` to `v0.2.0`. + +## If you need to delete a bad tag + +```bash +git tag -d v0.2.0 +git push origin :refs/tags/v0.2.0 +``` + +Then delete the package version manually in the GitHub UI under `github.com/orgs/ProjectASAP/packages` if images were already pushed. From 6e1d8d9f5f1036e19e5e6e5a079152cafe72b6bf Mon Sep 17 00:00:00 2001 From: Milind Srivastava Date: Sun, 8 Mar 2026 13:29:59 -0400 Subject: [PATCH 2/3] Fixed CI --- .github/workflows/docker.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bcd4faf..3be7453 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -41,14 +41,14 @@ jobs: run: | docker build \ -t sketchdb-base:latest \ - -t ghcr.io/projectasap/asap-base:${{ github.ref_name }} \ - -t ghcr.io/projectasap/asap-base:latest \ -f asap-common/installation/Dockerfile \ asap-common - name: Push base image if: startsWith(github.ref, 'refs/tags/') run: | + docker tag sketchdb-base:latest ghcr.io/projectasap/asap-base:${{ github.ref_name }} + docker tag sketchdb-base:latest ghcr.io/projectasap/asap-base:latest docker push ghcr.io/projectasap/asap-base:${{ github.ref_name }} docker push ghcr.io/projectasap/asap-base:latest @@ -56,14 +56,15 @@ jobs: - name: Build planner image run: | docker build \ - -t ghcr.io/projectasap/asap-planner:${{ github.ref_name }} \ - -t ghcr.io/projectasap/asap-planner:latest \ + -t asap-planner:local \ -f asap-planner/Dockerfile \ asap-planner - name: Push planner image if: startsWith(github.ref, 'refs/tags/') run: | + docker tag asap-planner:local ghcr.io/projectasap/asap-planner:${{ github.ref_name }} + docker tag asap-planner:local ghcr.io/projectasap/asap-planner:latest docker push ghcr.io/projectasap/asap-planner:${{ github.ref_name }} docker push ghcr.io/projectasap/asap-planner:latest @@ -71,14 +72,15 @@ jobs: - name: Build sketch-ingest image run: | docker build \ - -t ghcr.io/projectasap/asap-sketch-ingest:${{ github.ref_name }} \ - -t ghcr.io/projectasap/asap-sketch-ingest:latest \ + -t asap-sketch-ingest:local \ -f asap-sketch-ingest/Dockerfile \ asap-sketch-ingest - name: Push sketch-ingest image if: startsWith(github.ref, 'refs/tags/') run: | + docker tag asap-sketch-ingest:local ghcr.io/projectasap/asap-sketch-ingest:${{ github.ref_name }} + docker tag asap-sketch-ingest:local ghcr.io/projectasap/asap-sketch-ingest:latest docker push ghcr.io/projectasap/asap-sketch-ingest:${{ github.ref_name }} docker push ghcr.io/projectasap/asap-sketch-ingest:latest @@ -86,14 +88,15 @@ jobs: - name: Build prometheus-client image run: | docker build \ - -t ghcr.io/projectasap/asap-prometheus-client:${{ github.ref_name }} \ - -t ghcr.io/projectasap/asap-prometheus-client:latest \ + -t asap-prometheus-client:local \ -f asap-tools/queriers/prometheus-client/Dockerfile \ asap-tools/queriers/prometheus-client - name: Push prometheus-client image if: startsWith(github.ref, 'refs/tags/') run: | + docker tag asap-prometheus-client:local ghcr.io/projectasap/asap-prometheus-client:${{ github.ref_name }} + docker tag asap-prometheus-client:local ghcr.io/projectasap/asap-prometheus-client:latest docker push ghcr.io/projectasap/asap-prometheus-client:${{ github.ref_name }} docker push ghcr.io/projectasap/asap-prometheus-client:latest @@ -105,7 +108,7 @@ jobs: file: asap-query-engine/Dockerfile push: ${{ startsWith(github.ref, 'refs/tags/') }} tags: | - ghcr.io/projectasap/asap-query-engine:${{ github.ref_name }} + ghcr.io/projectasap/asap-query-engine:${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'pr-test' }} ghcr.io/projectasap/asap-query-engine:latest cache-from: type=registry,ref=ghcr.io/projectasap/asap-query-engine:buildcache cache-to: type=registry,ref=ghcr.io/projectasap/asap-query-engine:buildcache,mode=max From 7e2c5d98557f41c2b2a3d1331980da1b564c2c17 Mon Sep 17 00:00:00 2001 From: Milind Srivastava Date: Sun, 8 Mar 2026 13:34:24 -0400 Subject: [PATCH 3/3] Removed extra line from Dockerfile --- asap-sketch-ingest/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/asap-sketch-ingest/Dockerfile b/asap-sketch-ingest/Dockerfile index 259e004..8432840 100644 --- a/asap-sketch-ingest/Dockerfile +++ b/asap-sketch-ingest/Dockerfile @@ -10,7 +10,6 @@ WORKDIR /app RUN pip3 install --no-cache-dir jinja2 requests loguru pyyaml # Copy application code -COPY classes/ ./classes/ COPY utils/ ./utils/ COPY templates/ ./templates/ COPY examples/ ./examples/