From b258113547f636fa89e28cc29b3fd67e6f1e15b2 Mon Sep 17 00:00:00 2001 From: undercover-cactus Date: Tue, 10 Feb 2026 17:36:07 +0100 Subject: [PATCH] use ARG to build Dockerfile; use local chain everywhere; --- .github/workflows/task-docker-ci.yml | 1 + operator/.dockerignore | 1 - operator/Dockerfile | 62 ++++++---------------------- test/e2e/framework/validators.ts | 2 + test/launcher/storagehub-docker.ts | 4 ++ test/package.json | 2 +- test/utils/validators.ts | 2 + 7 files changed, 22 insertions(+), 52 deletions(-) diff --git a/.github/workflows/task-docker-ci.yml b/.github/workflows/task-docker-ci.yml index c5b9c1fe..14186dc8 100644 --- a/.github/workflows/task-docker-ci.yml +++ b/.github/workflows/task-docker-ci.yml @@ -75,6 +75,7 @@ jobs: dockerfile: ./operator/Dockerfile context: . registry: ghcr.io + build_args: ./build/datahaven-node registry_username: ${{ github.actor }} registry_password: ${{ secrets.GITHUB_TOKEN }} image_tags: ${{ steps.meta.outputs.tags }} diff --git a/operator/.dockerignore b/operator/.dockerignore index 8f7393e4..13c345c5 100644 --- a/operator/.dockerignore +++ b/operator/.dockerignore @@ -50,4 +50,3 @@ examples/ Cargo.lock.old *.toml.old *.lock.old -**/target/ \ No newline at end of file diff --git a/operator/Dockerfile b/operator/Dockerfile index dc3142c3..81112c36 100644 --- a/operator/Dockerfile +++ b/operator/Dockerfile @@ -1,21 +1,12 @@ # DataHaven Operator Image -# -# This is the standard operator image used for CI and release builds. -# It's a minimal image that accepts a pre-built binary. -# -# Usage: -# - CI builds: Binary from build-operator workflow artifact -# - Release builds: Binary from build-operator workflow artifact -# - Local builds: Binary from local cargo build -# -# Expected Binary Location: -# build/datahaven-node -# -# Registries: -# - GHCR: ghcr.io/datahaven-xyz/datahaven/datahaven (CI) -# - DockerHub: datahavenxyz/datahaven (releases) -FROM debian:stable AS builder +FROM debian:stable-slim + +LABEL version="0.4.0" +LABEL description="DataHaven Node - Release Build" +LABEL maintainer="steve@moonsonglabs.com" + +ARG BINARY_PATH=./target/x86_64-unknown-linux-gnu/release/datahaven-node # Install CA certificates and libpq5 for the release build RUN apt-get update && \ @@ -26,44 +17,17 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* -FROM debian:stable-slim - -LABEL version="0.4.0" -LABEL description="DataHaven Node - Release Build" -LABEL maintainer="steve@moonsonglabs.com" - -# Copy CA certificates and shared libraries from builder -COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -COPY --from=builder \ - /lib/x86_64-linux-gnu/libpq.so.5 \ - /lib/x86_64-linux-gnu/libssl.so.3 \ - /lib/x86_64-linux-gnu/libcrypto.so.3 \ - /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 \ - /lib/x86_64-linux-gnu/libldap.so.2 \ - /lib/x86_64-linux-gnu/libz.so.1 \ - /lib/x86_64-linux-gnu/libzstd.so.1 \ - /lib/x86_64-linux-gnu/libkrb5.so.3 \ - /lib/x86_64-linux-gnu/libk5crypto.so.3 \ - /lib/x86_64-linux-gnu/libcom_err.so.2 \ - /lib/x86_64-linux-gnu/libkrb5support.so.0 \ - /lib/x86_64-linux-gnu/liblber.so.2 \ - /lib/x86_64-linux-gnu/libsasl2.so.2 \ - /lib/x86_64-linux-gnu/libkeyutils.so.1 \ - /lib/x86_64-linux-gnu/ - # Create datahaven user and directories RUN useradd -m -u 1001 -U -s /bin/sh -d /datahaven datahaven && \ - mkdir -p /data /datahaven/.local/share && \ - chown -R datahaven:datahaven /data /datahaven/.local/share && \ - ln -s /data /datahaven/.local/share/datahaven-node - + mkdir -p /datahaven/.local/share && \ + chown -R datahaven:datahaven /datahaven/.local/share USER datahaven # Copy pre-built binary -COPY --chown=datahaven:datahaven build/* /usr/local/bin +COPY --chown=datahaven:datahaven $BINARY_PATH /usr/local/bin # Make binary executable -RUN chmod uog+x /usr/local/bin/datahaven* +RUN chmod uog+x /usr/local/bin/datahaven-node # Expose ports # 30333: p2p networking @@ -71,6 +35,4 @@ RUN chmod uog+x /usr/local/bin/datahaven* # 9615: Prometheus metrics EXPOSE 30333 9944 9615 -VOLUME ["/data"] - -ENTRYPOINT ["/usr/local/bin/datahaven-node"] +ENTRYPOINT ["datahaven-node"] diff --git a/test/e2e/framework/validators.ts b/test/e2e/framework/validators.ts index 4dcd074c..f7ff8602 100644 --- a/test/e2e/framework/validators.ts +++ b/test/e2e/framework/validators.ts @@ -52,6 +52,8 @@ export const launchDatahavenValidator = async ( const COMMON_LAUNCH_ARGS = [ "--unsafe-force-node-key-generation", "--tmp", + "--chain", + "local", "--validator", "--discover-local", "--no-prometheus", diff --git a/test/launcher/storagehub-docker.ts b/test/launcher/storagehub-docker.ts index 5800dafb..8419d824 100644 --- a/test/launcher/storagehub-docker.ts +++ b/test/launcher/storagehub-docker.ts @@ -159,6 +159,7 @@ export const launchMspNode = async ( "-p", `${wsPort}:${DEFAULT_SUBSTRATE_WS_PORT}`, options.datahavenImageTag, + "--tmp", "--name", "msp-charlie", "--chain", @@ -246,6 +247,7 @@ export const launchBspNode = async ( "-p", `${wsPort}:${DEFAULT_SUBSTRATE_WS_PORT}`, options.datahavenImageTag, + "--tmp", "--name", "bsp-dorothy", "--chain", @@ -333,6 +335,7 @@ export const launchIndexerNode = async ( "-p", `${wsPort}:${DEFAULT_SUBSTRATE_WS_PORT}`, options.datahavenImageTag, + "--tmp", "--name", "indexer", "--chain", @@ -408,6 +411,7 @@ export const launchFishermanNode = async ( "-p", `${wsPort}:${DEFAULT_SUBSTRATE_WS_PORT}`, options.datahavenImageTag, + "--tmp", "--chain", "local", "--name", diff --git a/test/package.json b/test/package.json index c18048eb..3b93ad90 100644 --- a/test/package.json +++ b/test/package.json @@ -7,7 +7,7 @@ "cli": "bun run cli/index.ts", "fmt": "biome check .", "fmt:fix": "biome check --write .", - "build:docker:operator": "docker build --no-cache --platform linux/amd64 -t datahavenxyz/datahaven:local -f ../docker/datahaven-dev.Dockerfile ../.", + "build:docker:operator": "docker build --no-cache --platform linux/amd64 -t datahavenxyz/datahaven:local -f ../operator/Dockerfile ../operator", "generate:wagmi": "wagmi generate", "generate:snowbridge-cfgs": "bun -e \"import {generateSnowbridgeConfigs} from './scripts/gen-snowbridge-cfgs.ts'; await generateSnowbridgeConfigs()\"", "generate:contracts": "bun -e \"import {generateContracts} from './scripts/generate-contracts.ts'; await generateContracts()\"", diff --git a/test/utils/validators.ts b/test/utils/validators.ts index 637c9ae6..5e635200 100644 --- a/test/utils/validators.ts +++ b/test/utils/validators.ts @@ -8,6 +8,8 @@ export const COMMON_LAUNCH_ARGS = [ "--unsafe-force-node-key-generation", "--tmp", + "--chain", + "local", "--validator", "--discover-local", "--no-prometheus",