From 5894b753fd462625e1a3305bdf0de33ddb0fd1f2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 22:42:29 +0000 Subject: [PATCH 1/5] Initial plan From 35e1537e7b37055f32f04f196adf2b94a9ad408e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 22:46:21 +0000 Subject: [PATCH 2/5] Add GitHub Action workflow to publish Docker images to GHCR Co-authored-by: zgypa <5678168+zgypa@users.noreply.github.com> --- .github/workflows/publish-ghcr.yml | 61 ++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/publish-ghcr.yml diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml new file mode 100644 index 0000000..eed5edd --- /dev/null +++ b/.github/workflows/publish-ghcr.yml @@ -0,0 +1,61 @@ +name: Publish to GHCR + +on: + push: + branches: + - main + - develop + tags: + - 'v*' + pull_request: + branches: + - main + - develop + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the 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 (tags, labels) for Docker + 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 Docker image + uses: docker/build-push-action@v6 + with: + context: . + 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 diff --git a/.gitignore b/.gitignore index 85ac923..8c41702 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,4 @@ dist/ *.orig terraform.tfstate terraform.tfstate.* +actionlint From 66a28d540e367bcd86a292be01e772b616077aa3 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Tue, 2 Dec 2025 00:00:04 +0100 Subject: [PATCH 3/5] Update README.md to include Docker workflow and release process instructions --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 520f5eb..c75b014 100644 --- a/README.md +++ b/README.md @@ -16,3 +16,18 @@ This FastAPI service exposes lightweight endpoints for both coarse X-ray typing ## Utilities - `BFD9020.html` – browser tester that runs all endpoints in sequence. When the API is running visit `/test`; otherwise open the file locally and point it to a remote base URL. TIFF previews are decoded client-side via vendored `pako` + `UTIF` scripts exposed from `/static`. + +## Local Docker Workflow + +- Build the image standalone: `docker build -t bfd9020:test .` from the repo root. +- Run the container directly: `docker run --rm -p 9020:9020 bfd9020:test`. +- Or use the provided `docker-compose.yml` for a one-liner: `docker compose up --build` (press `Ctrl+C` to stop). +- Hit `http://localhost:9020` or open `BFD9020.html` and point it at the local API to verify endpoints. + +## Release Process (git-flow) + +- Start a release branch from `develop`: `git flow release start vX.Y.Z` (use SemVer). +- Update release artifacts (docs, changelog) and ensure tests pass; no hard-coded version file exists, so choosing the new SemVer is enough. +- Finish the release to merge into `main` and back into `develop`: `git flow release finish vX.Y.Z`. +- Push updated branches and the annotated tag: `git push origin main develop --tags`. +- Pushing the tag triggers the GHCR workflow, producing images tagged with the SemVer and branch/SHA variants. From d9197b788fc16cb8d8cb60e410022bbb5c9330e8 Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Tue, 2 Dec 2025 00:07:56 +0100 Subject: [PATCH 4/5] Remove 'develop' branch from GitHub Actions workflow triggers --- .github/workflows/publish-ghcr.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml index eed5edd..e62d8fa 100644 --- a/.github/workflows/publish-ghcr.yml +++ b/.github/workflows/publish-ghcr.yml @@ -4,13 +4,11 @@ on: push: branches: - main - - develop tags: - 'v*' pull_request: branches: - main - - develop env: REGISTRY: ghcr.io From 73bf254de313f9a77c24edfc772a340e778ca68a Mon Sep 17 00:00:00 2001 From: Toni Magni Date: Tue, 2 Dec 2025 00:20:58 +0100 Subject: [PATCH 5/5] Add image specification for API service in docker-compose.yml --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index af1db6f..66b0ebb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,6 @@ services: api: + image: ghcr.io/open-ortho/edu.case.bfd9020:local build: context: . dockerfile: Dockerfile