Skip to content

Commit

Permalink
add action
Browse files Browse the repository at this point in the history
  • Loading branch information
Salka1988 committed Apr 22, 2024
1 parent 555f902 commit 6821116
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-subgraph
dockerfile: firehose/Dockerfile
dockerfile: firehose/Dockerfile
context: firehose
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
firehose:
build:
context: firehose
dockerfile: Dockerfile
ports:
- "10015:10015"
- "10016:10016"
Expand Down
27 changes: 14 additions & 13 deletions firehose/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
# Stage 1: Use cargo-chef to generate a recipe
FROM lukemathwalker/cargo-chef:latest-rust-1.76-slim AS chef

WORKDIR /app

## Planner stage
# Stage 2: Planner
FROM chef AS planner
COPY ./firehose-extract/ ./firehose-extract/
COPY ./firehose-extract/ /app/
RUN cargo chef prepare --recipe-path recipe.json

# Extract builder stage
# Stage 3: Extract builder
FROM chef AS extract_builder
RUN apt update && apt install -y protobuf-compiler
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY ./firehose-extract/ ./firehose-extract/
COPY ./firehose-extract/ /app/
RUN cargo build --release

# Stage 4: Go build
FROM golang:1.22-alpine as go_build
COPY ./firehose-core/ ./firehose-core/
COPY ./substreams/ ./substreams/
WORKDIR firehose-core
COPY ./firehose-core/ /app/firehose-core/
COPY ./substreams/ /app/substreams/
WORKDIR /app/firehose-core
RUN go mod download
ARG VERSION="dev"
RUN apk --no-cache add git
RUN go build -v -ldflags "-X main.version=${VERSION}" -o /firehose-core/firecore ./cmd/firecore
RUN go build -v -ldflags "-X main.version=${VERSION}" -o /app/firehose-core/firecore ./cmd/firecore

# Final stage
# Stage 5: Final stage
FROM debian
COPY --from=extract_builder /app/target/release/firehose-extract ./app/firehose-extract
COPY --from=go_build /firehose-core/firecore ./app/firecore
COPY ./firehose-core/devel/standard/bootstrap.sh /app/start.sh
COPY --from=extract_builder /app/target/release/firehose-extract /app/firehose-extract
COPY --from=go_build /app/firehose-core/firecore /app/firecore
COPY --from=go_build /app/firehose-core/devel/standard/bootstrap.sh /app/start.sh
RUN chmod +x /app/start.sh

# Additional setup if needed
Expand Down

0 comments on commit 6821116

Please sign in to comment.