From 555f90235628e343f1a0353e47b6fbae2680d831 Mon Sep 17 00:00:00 2001 From: Salka1988 Date: Mon, 22 Apr 2024 10:50:32 +0200 Subject: [PATCH] add action --- .github/workflows/docker-publish.yml | 64 ++++++++++++++-------------- firehose/Dockerfile | 8 ++-- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 6c1e063..df1e99d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,32 +1,32 @@ -#name: Build and 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-subgraph -# dockerfile: firehose/Dockerfile \ No newline at end of file +name: Build and 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-subgraph + dockerfile: firehose/Dockerfile \ No newline at end of file diff --git a/firehose/Dockerfile b/firehose/Dockerfile index f79f577..f8d82cf 100644 --- a/firehose/Dockerfile +++ b/firehose/Dockerfile @@ -4,15 +4,15 @@ WORKDIR /app ## Planner stage FROM chef AS planner -COPY ./firehose-extract/ . +COPY ./firehose-extract/ ./firehose-extract/ RUN cargo chef prepare --recipe-path recipe.json # Extract builder stage FROM chef AS extract_builder RUN apt update && apt install -y protobuf-compiler -COPY --from=planner app/recipe.json recipe.json +COPY --from=planner /app/recipe.json recipe.json RUN cargo chef cook --release --recipe-path recipe.json -COPY ./firehose-extract/ . +COPY ./firehose-extract/ ./firehose-extract/ RUN cargo build --release FROM golang:1.22-alpine as go_build @@ -32,4 +32,4 @@ COPY ./firehose-core/devel/standard/bootstrap.sh /app/start.sh RUN chmod +x /app/start.sh # Additional setup if needed -ENTRYPOINT [ "/app/start.sh" ] \ No newline at end of file +ENTRYPOINT [ "/app/start.sh" ]