-
Notifications
You must be signed in to change notification settings - Fork 0
ci: add Dockerfile and build-and-publish workflow #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
086902a
build: add Dockerfile, docker-compose, and justfile for local image b…
RembrandtK 2eb2ee7
ci: add build-and-publish workflow for Docker image
RembrandtK 49646ef
build: add .dockerignore
RembrandtK 449e3cd
ci: gate registry login and cache export on non-PR events
RembrandtK 3be1cb5
build: bump base image to node:24-bookworm-slim
RembrandtK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # VCS / CI | ||
| .git | ||
| .github | ||
|
|
||
| # Local agent / editor state | ||
| .claude | ||
| .vscode | ||
| .idea | ||
| .DS_Store | ||
| CLAUDE.md | ||
|
|
||
| # Dependencies (rebuilt inside the image by npm ci) | ||
| node_modules | ||
|
|
||
| # Build artefacts (regenerated downstream) | ||
| build | ||
| generated | ||
| subgraph.yaml | ||
|
|
||
| # Docker / local tooling | ||
| Dockerfile | ||
| .dockerignore | ||
| docker-compose.yml | ||
| justfile | ||
|
|
||
| # Test outputs | ||
| tests/.bin | ||
| tests/.latest.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Build and upload Docker image | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: [main] | ||
| tags: ['v*'] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-image: | ||
| runs-on: ubuntu-latest | ||
|
RembrandtK marked this conversation as resolved.
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
RembrandtK marked this conversation as resolved.
|
||
|
|
||
| - uses: docker/setup-buildx-action@v4 | ||
|
|
||
| - id: meta | ||
| uses: docker/metadata-action@v6 | ||
| with: | ||
| images: ghcr.io/graphprotocol/indexing-payments-subgraph | ||
| tags: | | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
| type=ref,event=tag | ||
| type=sha | ||
|
|
||
| - uses: docker/login-action@v4 | ||
| if: github.event_name != 'pull_request' | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - uses: docker/build-push-action@v7 | ||
| with: | ||
| file: Dockerfile | ||
| context: . | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| pull: true | ||
| cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/indexing-payments-subgraph:buildcache | ||
|
RembrandtK marked this conversation as resolved.
|
||
| cache-to: ${{ github.event_name != 'pull_request' && format('type=registry,ref=ghcr.io/{0}/indexing-payments-subgraph:buildcache,mode=max', github.repository_owner) || '' }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,4 @@ node_modules/ | |
| tests/.bin | ||
| tests/.latest.json | ||
| subgraph.yaml | ||
| .claude/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Packages the subgraph source and prebuilt node_modules at | ||
| # /opt/indexing-payments-subgraph. Consumed via multi-stage COPY by | ||
| # downstream deployers (e.g. edgeandnode/local-network subgraph-deploy). | ||
| # | ||
| # The image has no entrypoint: it is a source carrier, not a runtime service. | ||
|
|
||
| FROM node:24-bookworm-slim | ||
|
|
||
| WORKDIR /opt/indexing-payments-subgraph | ||
|
|
||
| # Install dependencies first so source edits don't invalidate this layer. | ||
| COPY package.json package-lock.json ./ | ||
| RUN npm ci --ignore-scripts | ||
|
|
||
| COPY . . | ||
|
RembrandtK marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| services: | ||
| indexing-payments-subgraph: | ||
| image: ghcr.io/graphprotocol/indexing-payments-subgraph:${TAG:-local} | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| default: | ||
| @just --list | ||
|
|
||
| # Build local image consumable by downstream deployers (e.g. local-network). | ||
| # Tags as ghcr.io/graphprotocol/indexing-payments-subgraph:local. | ||
| build-image: | ||
| docker compose build |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.