File tree Expand file tree Collapse file tree 3 files changed +102
-0
lines changed
Expand file tree Collapse file tree 3 files changed +102
-0
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 1+ # Publishes the Docker image.
2+
3+ name : docker
4+
5+ on :
6+ workflow_dispatch : {}
7+ push :
8+ tags :
9+ - v*
10+
11+ jobs :
12+ build :
13+ name : build and push
14+ runs-on : ubuntu-24.04
15+ permissions :
16+ packages : write
17+ contents : read
18+ steps :
19+ - uses : actions/checkout@v4
20+
21+ - name : Set up Docker CLI
22+ uses : docker/setup-buildx-action@v3
23+
24+ - name : Login to GHCR
25+ uses : docker/login-action@v3
26+ with :
27+ registry : ghcr.io
28+ username : ${{ github.actor }}
29+ password : ${{ secrets.GITHUB_TOKEN }}
30+
31+ - name : Build and push tagged
32+ uses : docker/build-push-action@v6
33+ if : github.event_name != 'workflow_dispatch'
34+ with :
35+ context : .
36+ file : Dockerfile
37+ platforms : linux/amd64
38+ push : true
39+ tags : |
40+ ghcr.io/ithacaxyz/rpc-tester:latest
41+ ghcr.io/ithacaxyz/rpc-tester:${{ github.ref_name }}
42+ cache-from : type=gha
43+ cache-to : type=gha,mode=max
44+
45+ - name : Get short commit
46+ if : github.event_name == 'workflow_dispatch'
47+ id : vars
48+ run : echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
49+
50+ - name : Build and push dispatched
51+ uses : docker/build-push-action@v6
52+ if : github.event_name == 'workflow_dispatch'
53+ with :
54+ context : .
55+ file : Dockerfile
56+ platforms : linux/amd64
57+ push : true
58+ tags : |
59+ ghcr.io/ithacaxyz/rpc-tester:${{ steps.vars.outputs.sha_short }}
60+ cache-from : type=gha
61+ cache-to : type=gha,mode=max
Original file line number Diff line number Diff line change 1+ FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
2+ WORKDIR /app
3+
4+ LABEL org.opencontainers.image.source=https://github.com/ithacaxyz/rpc-tester
5+
6+ # Builds a cargo-chef plan
7+ FROM chef AS planner
8+ COPY . .
9+ RUN cargo chef prepare --recipe-path recipe.json
10+
11+ FROM chef AS builder
12+ COPY --from=planner /app/recipe.json recipe.json
13+
14+ # Install system dependencies
15+ RUN apt-get update && apt-get -y upgrade && apt-get install -y libclang-dev pkg-config
16+
17+ # Builds dependencies
18+ RUN cargo chef cook --recipe-path recipe.json
19+
20+ # Copy source
21+ COPY . .
22+
23+ # Build application
24+ RUN cargo build --locked --release
25+
26+ # ARG is not resolved in COPY so we have to hack around it by copying the
27+ # binary to a temporary location
28+ RUN cp /app/target/release/rpc-tester-cli /app/rpc-tester-cli
29+
30+ # Use Ubuntu as the release image
31+ FROM ubuntu AS runtime
32+ WORKDIR /app
33+
34+ # Install runtime dependencies
35+ RUN apt-get update && apt-get -y upgrade && apt-get install -y ca-certificates && update-ca-certificates
36+
37+ # Copy rpc-tester over from the build stage
38+ COPY --from=builder /app/rpc-tester-cli /usr/local/bin
39+
40+ EXPOSE 9119
41+ ENTRYPOINT ["/usr/local/bin/rpc-tester-cli" ]
You can’t perform that action at this time.
0 commit comments