diff --git a/.github/workflows/code-check.yml b/.github/workflows/code-check.yml index 644ec9a9c..963ed6c9e 100644 --- a/.github/workflows/code-check.yml +++ b/.github/workflows/code-check.yml @@ -224,25 +224,3 @@ jobs: name: integration-test-artifacts-${{ runner.os }}-${{ github.sha }} include-hidden-files: true path: tests/.tmp* - - build-docker: - name: Docker build - if: ${{ !startsWith(github.event.pull_request.title, '[WIP]') && !contains(github.event.label.name, 'DO NOT MERGE') }} - needs: - - formatting - - cargo-deny - - unused-deps - - lints - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # Version 4.2.2 - - name: Setup docker buildx - uses: docker/setup-buildx-action@afeb29a6e0d7d6258844ecabe6eba67d13443680 # Version 3.1.0 - - name: Build Docker Image - uses: docker/build-push-action@84ad562665bb303b549fec655d1b64f9945f3f91 # Version 6.15.0 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64 - push: false diff --git a/.github/workflows/publish-node-image.yml b/.github/workflows/publish-node-image.yml new file mode 100644 index 000000000..c5a5c61ac --- /dev/null +++ b/.github/workflows/publish-node-image.yml @@ -0,0 +1,66 @@ +name: Publish Logos Blockchain Node Docker Image + +on: + release: + types: [published, created] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: logos-blockchain-node + +jobs: + push_to_registries: + name: Push Docker image to multiple registries + runs-on: ubuntu-latest + + permissions: + packages: write + contents: read + attestations: write + id-token: write + + steps: + - name: Check out the repo + uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # Version 4.2.2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # Version 3.7.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@afeb29a6e0d7d6258844ecabe6eba67d13443680 # Version 3.10.0 + with: + driver: docker-container + install: true + + - name: Log in to the Container registry + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # Version 3.4.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # Version 5.7.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push multi-platform Docker images + id: push + uses: docker/build-push-action@84ad562665bb303b549fec655d1b64f9945f3f91 # Version 6.15.0 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + labels: ${{ steps.meta.outputs.labels }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@9d3beef6515cb82652d066f999b94affc15acfac # Version 2.2.3 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/Dockerfile b/Dockerfile index abc4c11f7..46bbc2de1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,57 +2,42 @@ # check=skip=SecretsUsedInArgOrEnv # Ignore warnings about sensitive information as this is test data. -ARG VERSION=v0.2.0 +ARG LB_CIRCUITS_VERSION=v0.4.1 +ARG LB_NODE_VERSION=0.1.1 # =========================== # BUILD IMAGE # =========================== -FROM rust:1.93.0-slim-bookworm AS builder +FROM alpine:latest AS builder -ARG VERSION - -LABEL maintainer="augustinas@status.im" \ - source="https://github.com/logos-blockchain/logos-blockchain" \ - description="Logos blockchain node build image" +ARG LB_CIRCUITS_VERSION +ARG LB_NODE_VERSION WORKDIR /logos-blockchain COPY . . -# Install dependencies needed for building RocksDB. -RUN apt-get update && apt-get install -yq \ - git gcc g++ clang libssl-dev pkg-config ca-certificates curl - -RUN chmod +x scripts/setup-logos-blockchain-circuits.sh && \ - scripts/setup-logos-blockchain-circuits.sh "$VERSION" "/opt/circuits" - -ENV LOGOS_BLOCKCHAIN_CIRCUITS=/opt/circuits - -RUN cargo build --locked --release -p logos-blockchain-node +RUN apk add --no-cache curl bash +RUN scripts/setup-logos-blockchain-circuits.sh "$LB_CIRCUITS_VERSION" "/opt/circuits" +RUN scripts/setup-logos-blockchain-node.sh "$LB_NODE_VERSION" "linux-$(uname -m)" # =========================== # NODE IMAGE # =========================== -FROM debian:bookworm-slim +FROM debian:trixie-slim -ARG VERSION +ARG LB_CIRCUITS_VERSION LABEL maintainer="augustinas@status.im" \ source="https://github.com/logos-blockchain/logos-blockchain" \ description="Logos blockchain node image" -RUN apt-get update && apt-get install -yq \ - libstdc++6 \ - libssl3 \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* - COPY --from=builder /opt/circuits /opt/circuits -COPY --from=builder /logos-blockchain/target/release/logos-blockchain-node /usr/local/bin/logos-blockchain-node +COPY --from=builder /usr/local/bin/logos-blockchain-node /usr/local/bin/logos-blockchain-node ENV LOGOS_BLOCKCHAIN_CIRCUITS=/opt/circuits EXPOSE 3000 8080 9000 60000 -ENTRYPOINT ["logos-blockchain-node"] \ No newline at end of file +ENTRYPOINT ["logos-blockchain-node"] diff --git a/README.md b/README.md index ace2dcdae..991f7af2e 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ Currently the `"profiling"` feature is not supported in Windows builds. To build the Logos blockchain Docker image, run: ```bash -docker build -t logos-blockchain . +docker build -t logos-blockchain-node . ``` #### Command line @@ -236,19 +236,7 @@ To run a docker container with the Logos blockchain node you need to mount both the configuration. ```bash -docker run -v "/path/to/config.yml" -v "/path/to/global_params:global/params/path" logos-blockchain /etc/logos-blockchain/config.yml -``` - -To use an example configuration located at `nodes/node/config.yaml`, first run the test that generates the random -kzgrs file and then run the docker container with the appropriate config and global params: - -```bash -cargo test --package logos-blockchain-kzgrs-backend write_random_kzgrs_params_to_file -- --ignored - -docker run -v "$(pwd)/nodes/node/config.yaml:/etc/logos-blockchain/config.yml" \ - -v "$(pwd)/logos-blockchain-da/kzgrs-backend/kzgrs_test_params:/app/tests/kzgrs/kzgrs_test_params" \ - logos-blockchain /etc/logos-blockchain/config.yml - +docker run -v "/path/to/config.yml:/config.yml" logos-blockchain-node /config.yml ``` #### Running Logos Blockchain Node locally diff --git a/scripts/setup-logos-blockchain-node.sh b/scripts/setup-logos-blockchain-node.sh new file mode 100755 index 000000000..c0bf27b1c --- /dev/null +++ b/scripts/setup-logos-blockchain-node.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +VERSION="${1:-0.1.1}" +PLATFORM="${2:-linux-x86_64}" +OUT_PATH="${3:-/usr/local/bin}/logos-blockchain-node" + +echo "Installing Logos Node $VERSION ($PLATFORM) to $OUT_PATH." + +curl -Lfo "$OUT_PATH" --create-dirs \ + "https://github.com/logos-blockchain/logos-blockchain/releases/download/$VERSION/logos-blockchain-node-$PLATFORM-$VERSION" + +chmod +x "$OUT_PATH" + +echo "Done."