Skip to content
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

Add CI #19

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/actions/docker-publish/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: 'Build & Plush Docker'

inputs:
compose-version:
description: 'Docker Compose version'
default: 2.6.0
registry:
description: 'Docker registry service'
default: ghcr.io
username:
description: 'Username for https://ghcr.io'
required: true
password:
description: 'Password for https://ghcr.io'
required: true
image:
description: 'Image name with provider url'
required: true
dockerfile:
description: 'Path to the Dockerfile'
required: true
context:
description: 'Path to the Context'
default: .
required: true
build-args:
description: 'List of build-time variables'
required: false

outputs:
image:
description: 'Image url'
value: ${{ steps.imageOuput.outputs.imageUrl }}
imageid:
description: 'Image ID'
value: ${{ steps.publish.outputs.imageId }}
digest:
description: 'Image digest'
value: ${{ steps.publish.outputs.digest }}
metadata:
description: 'Build result metadata'
value: ${{ steps.publish.outputs.metadata }}

runs:
using: 'composite'
steps:
- name: Log in to the ghcr.io registry
uses: docker/login-action@v2
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ inputs.image }}
tags: |
type=ref,event=branch
type=sha,prefix=
type=semver,pattern={{raw}}
flavor: |
latest=${{ github.ref == 'refs/heads/master' }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build and push the image to ghcr.io
uses: docker/build-push-action@v4
id: publish
with:
context: ${{ inputs.context }}
platforms: linux/amd64
file: ${{ inputs.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: ${{ inputs.build-args }}
cache-from: type=gha
cache-to: type=gha,mode=max
- id: imageOuput
shell: bash
run: |
echo "imageUrl=${{ fromJSON(steps.publish.outputs.metadata)['image.name'] }}" >> $GITHUB_OUTPUT
32 changes: 32 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build ad publish Docker image

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-and-publish-image:
runs-on: buildjet-4vcpu-ubuntu-2204
if: |
(github.event_name == 'release' && github.event.action == 'published') ||
github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3

- name: Build and push Fuel Graph Node Image
uses: ./.github/actions/docker-publish
id: publish
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-graph-node
dockerfile: fuel-graph-node/Dockerfile
73 changes: 0 additions & 73 deletions fuel-graph-node/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions fuel-graph-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ members = [
"chain/*",
"graphql",
"node",
"runtime/*",
"runtime/derive",
"runtime/wasm",
"server/*",
"store/*",
"store/postgres",
"substreams/*",
"graph",
"tests",
]

[workspace.package]
Expand Down
58 changes: 58 additions & 0 deletions fuel-graph-node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

FROM rust:bullseye as graph-node-build

WORKDIR /app

RUN apt update && apt install -y protobuf-compiler
COPY ./fuel-graph-node /app/fuel-graph-node
RUN cd /app/fuel-graph-node && cargo build --release

# The graph-node runtime image with only the executable
FROM debian:bullseye-slim as graph-node
ENV RUST_LOG ""
ENV GRAPH_LOG ""
ENV EARLY_LOG_CHUNK_SIZE ""

ENV postgres_host ""
ENV postgres_user ""
ENV postgres_pass ""
ENV postgres_db ""
ENV postgres_args "sslmode=prefer"
# The full URL to the IPFS node
ENV ipfs ""
# The etherum network(s) to connect to. Set this to a space-separated
# list of the networks where each entry has the form NAME:URL
ENV ethereum ""
# The role the node should have, one of index-node, query-node, or
# combined-node
ENV node_role "combined-node"
# The name of this node
ENV node_id "default"
# The ethereum network polling interval (in milliseconds)
ENV ethereum_polling_interval ""

# The location of an optional configuration file for graph-node, as
# described in ../docs/config.md
# Using a configuration file is experimental, and the file format may
# change in backwards-incompatible ways
ENV GRAPH_NODE_CONFIG ""

# Disable core dumps; this is useful for query nodes with large caches. Set
# this to anything to disable coredumps (via 'ulimit -c 0')
ENV disable_core_dumps ""

# HTTP port
EXPOSE 8000
# WebSocket port
EXPOSE 8001
# JSON-RPC port
EXPOSE 8020
# Indexing status port
EXPOSE 8030

RUN apt-get update \
&& apt-get install -y libpq-dev ca-certificates netcat

COPY --from=graph-node-build /app/fuel-graph-node/target/release/graph-node /app/graph-node

CMD ["/app/graph-node"]
Loading