Skip to content

feat: Docker build section#2433

Merged
jeromy-cannon merged 7 commits intohiero-ledger:mainfrom
belloibrahv:feat/docker-build-section
Aug 14, 2025
Merged

feat: Docker build section#2433
jeromy-cannon merged 7 commits intohiero-ledger:mainfrom
belloibrahv:feat/docker-build-section

Conversation

@belloibrahv
Copy link
Copy Markdown
Contributor

Description

This pull request changes the following:

  • Add docker/Dockerfile for a multi-stage build that:
    • pulls required tools (Kind, kubectl, Helm, Docker CLI)
    • builds Solo from local source
    • installs the CLI globally and provides a quick-start entrypoint
  • Add docker/Taskfile.yaml with:
    • build:solo — builds Solo from source
    • build:docker — builds the Docker image and tags it as latest and x.y.z (from package.json)
    • build-all — runs build:solo then build:docker
  • Add docker/README.md with build/run/troubleshooting guidance
  • Add root .dockerignore to slim the build context
  • Keep root Taskfile.yml inclusion (docker/Taskfile.yaml) as-is

Scope of this PR (Chunk 1): Dockerfile + Taskfile + basic docs. CI integration (build/verify), reusable workflow, and publishing will follow as separate PRs under the same epic.

Related Issues

Pull request (PR) checklist

  • This PR added tests (unit, integration, and/or end-to-end)
  • This PR updated documentation
  • This PR added no TODOs or commented out code
  • This PR has no breaking changes
  • Any technical debt has been documented as a separate issue and linked to this PR (tracked under Feature: Solo Docker container image #2387)
  • Any package.json changes have been explained to and approved by a repository manager
  • All related issues have been linked to this PR
  • All changes in this PR are included in the description
  • When this PR merges the commits will be squashed and the title will be used as the commit message, the 'commit message guidelines' below have been followed

Testing

  • This PR added unit tests
  • This PR added integration/end-to-end tests
  • These changes required manual testing that is documented below
  • Anything not tested is documented

The following manual testing was done:

  1. Build Solo and the Docker image
# From repo root
task build-all
# or
cd docker && task build-all
  1. Validate CLI and tooling inside the container
docker run --rm -it --privileged hashgraph/solo:latest sh -lc \
  "solo --version && kind version && kubectl version --client && helm version --short"

The following was not tested:

  • CI build/verification of the Docker image (will be added in follow-up PRs)
  • Release publishing to a container registry (will be added in follow-up PRs)
  • Full quick-start E2E flow via CI (planned under the same epic)
Commit message guidelines

We use 'Conventional Commits' to ensure that our commit messages are easy to read, follow a consistent format, and for automated release note generation. Please follow the guidelines below when writing your commit messages:

  1. BREAKING CHANGE: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type. NOTE: currently breaking changes will only bump the MAJOR version.
  2. The title is prefixed with one of the following:
Prefix Description Semantic Version Update Captured in Release Notes
feat: a new feature MINOR Yes
fix: a bug fix PATCH Yes
perf: performance PATCH Yes
refactor: code change that isn't feature or fix none No
test: adding missing tests none No
docs: changes to documentation none Yes
build: changes to build process none No
ci: changes to CI configuration none No
style: formatting, missing semi-colons, etc none No
chore: updating grunt tasks etc; no production code change none No

@belloibrahv belloibrahv requested review from a team as code owners August 11, 2025 10:03
@belloibrahv belloibrahv changed the title Feat/docker build section feat/docker build section Aug 11, 2025
@belloibrahv belloibrahv changed the title feat/docker build section feat: Docker build section Aug 11, 2025
@belloibrahv belloibrahv force-pushed the feat/docker-build-section branch 2 times, most recently from 4bc7709 to 0f613e2 Compare August 11, 2025 10:26
@jeromy-cannon
Copy link
Copy Markdown
Contributor

@belloibrahv ,

Thank you for working on this!

So, based on some discussions with the team, we determined that we want this to be a deterministic image, and it is much easier to make it deterministic up front versus later.

In order to do that we will need to use a Debian or Ubuntu image to start with. We have some choices from here:

  1. get this working as-is with my comments about the amd64 + aarch64 and Taskfile, then we can merge this and put the deterministic image into the next PR.
  2. You could also update this PR for the review comments plus make this deterministic.
  3. get this PR merged, and you can work on the other items in the epic while someone else converts to make this a deterministic image.

Let me know which direction you want to take.

Here is a straightforward Docker container that is deterministic (multiple links to direct you to the relevant parts):

Also, for the workflow part (when you get to that), we use Qemu to build amd64 + aarch64:

@jeromy-cannon
Copy link
Copy Markdown
Contributor

@belloibrahv , also, if you want to talk to me more directly you can use Discord:

@jeromy-cannon jeromy-cannon added the PR: Unresolved Comments A pull request where there are comments and they need to be resolved. label Aug 11, 2025
@belloibrahv belloibrahv force-pushed the feat/docker-build-section branch from 04e3092 to a37b967 Compare August 12, 2025 11:08
@belloibrahv
Copy link
Copy Markdown
Contributor Author

Hi @jeromy-cannon! I've implemented all the feedback from your review:

Fixed Taskfile flattening issue: Removed flatten: true and resolved the dir: .. problem that was causing tsc command failures

Added multi-architecture support: Implemented architecture detection for Kind, Docker, kubectl, and Helm (now supports both amd64 and aarch64)

Fixed script logic: Removed redundant solo init and corrected to solo quick-start single deploy

Resolved npm ci issue: Build context now properly includes package-lock.json

Testing confirmed: All docker:* tasks now work correctly from both root and docker directories, with proper directory resolution using {{.TASKFILE_DIR}}/..

The Docker image should now build successfully on both architectures. Ready for your review when you have time.

@belloibrahv
Copy link
Copy Markdown
Contributor Author

Since you mentioned Discord for direct communication, I'll join the server and reach out if I have any questions during the review process. Thanks for the invite!

@jeromy-cannon
Copy link
Copy Markdown
Contributor

@belloibrahv , It is the end of my day here, I'll take a look at this tomorrow. Thanks again!

@jeromy-cannon jeromy-cannon added PR: Needs Team Approval A pull request that needs review from a team member. PR: Needs Manager Approval A pull request that needs review from a manager. and removed PR: Unresolved Comments A pull request where there are comments and they need to be resolved. labels Aug 12, 2025
Copy link
Copy Markdown
Contributor

@jeromy-cannon jeromy-cannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@belloibrahv , I had to make a change to docker/Taskfile.yaml to make progress:
image

Then, it throws this error:

[docker:build:docker] Step 17/28 : COPY package*.json ./
[docker:build:docker]  ---> Using cache
[docker:build:docker]  ---> 2e2a015973df
[docker:build:docker] Step 18/28 : RUN npm ci
[docker:build:docker]  ---> Running in 793dbd88bdc8
[docker:build:docker] npm warn EBADENGINE Unsupported engine {
[docker:build:docker] npm warn EBADENGINE   package: 'yargs@18.0.0',
[docker:build:docker] npm warn EBADENGINE   required: { node: '^20.19.0 || ^22.12.0 || >=23' },
[docker:build:docker] npm warn EBADENGINE   current: { node: 'v20.18.0', npm: '10.8.2' }
[docker:build:docker] npm warn EBADENGINE }
[docker:build:docker] npm warn EBADENGINE Unsupported engine {
[docker:build:docker] npm warn EBADENGINE   package: 'yargs-parser@22.0.0',
[docker:build:docker] npm warn EBADENGINE   required: { node: '^20.19.0 || ^22.12.0 || >=23' },
[docker:build:docker] npm warn EBADENGINE   current: { node: 'v20.18.0', npm: '10.8.2' }
[docker:build:docker] npm warn EBADENGINE }
[docker:build:docker] npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
[docker:build:docker] npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[docker:build:docker] npm warn deprecated lodash.get@4.4.2: This package is deprecated. Use the optional chaining (?.) operator instead.
[docker:build:docker] npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
[docker:build:docker] npm warn deprecated har-validator@5.1.5: this library is no longer supported
[docker:build:docker] npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
[docker:build:docker] npm warn deprecated @types/eslint__js@9.14.0: This is a stub types definition. @eslint/js provides its own type definitions, so you do not need this installed.
[docker:build:docker] npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
[docker:build:docker] 
[docker:build:docker] > @hashgraph/solo@0.41.0 prepare
[docker:build:docker] > node c8-nyc-bridge.mjs
[docker:build:docker] 
[docker:build:docker] node:internal/modules/cjs/loader:1228
[docker:build:docker]   throw err;
[docker:build:docker]   ^
[docker:build:docker] 
[docker:build:docker] Error: Cannot find module '/app/c8-nyc-bridge.mjs'
[docker:build:docker]     at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
[docker:build:docker]     at Module._load (node:internal/modules/cjs/loader:1051:27)
[docker:build:docker]     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
[docker:build:docker]     at node:internal/main/run_main_module:28:49 {
[docker:build:docker]   code: 'MODULE_NOT_FOUND',
[docker:build:docker]   requireStack: []
[docker:build:docker] }
[docker:build:docker] 
[docker:build:docker] Node.js v20.18.0
[docker:build:docker] npm error code 1
[docker:build:docker] npm error path /app
[docker:build:docker] npm error command failed
[docker:build:docker] npm error command sh -c node c8-nyc-bridge.mjs
[docker:build:docker] npm notice
[docker:build:docker] npm notice New major version of npm available! 10.8.2 -> 11.5.2
[docker:build:docker] npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.5.2
[docker:build:docker] npm notice To update run: npm install -g npm@11.5.2
[docker:build:docker] npm notice
[docker:build:docker] npm error A complete log of this run can be found in: /root/.npm/_logs/2025-08-13T18_01_45_624Z-debug-0.log
[docker:build:docker] The command '/bin/sh -c npm ci' returned a non-zero code: 1
task: Failed to run task "docker:build-all": exit status 1

I was going to merge it and get it fixed later, however we have to have all signatures signed and verified:
image

It currently shows:
image

When verified, it will show up like this:
image

You can read more about how to set it up and what commit signature verification is here: https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification

@jeromy-cannon jeromy-cannon added PR: Unresolved Comments A pull request where there are comments and they need to be resolved. and removed PR: Needs Team Approval A pull request that needs review from a team member. PR: Needs Manager Approval A pull request that needs review from a manager. labels Aug 13, 2025
@belloibrahv
Copy link
Copy Markdown
Contributor Author

Ok, thanks for pointing out that sign-off issue, I will try to resolve it now

- Add docker/Dockerfile for multi-stage build from local source
- Add docker/Taskfile.yaml with build-solo, build-docker, and build-all tasks
- Add docker/README.md with comprehensive build and usage documentation
- Integrate Docker tasks into root Taskfile.yml
- Container version matches Solo's package.json version
- Container includes all necessary tools (Kind, kubectl, Helm, Docker)
- Default command runs Solo quick-start single deploy

Addresses the Docker build section of issue hiero-ledger#2387

Signed-off-by: belloibrahv <belloibrahv@gmail.com>
…kerignore; align task names and aggregate build-all (part of hiero-ledger#2387)

Signed-off-by: belloibrahv <belloibrahv@gmail.com>
…y linting

Signed-off-by: belloibrahv <belloibrahv@gmail.com>
Signed-off-by: belloibrahv <belloibrahv@gmail.com>
… -n 'v'

Signed-off-by: belloibrahv <belloibrahv@gmail.com>
…upport

- Remove flatten: true from docker include to prevent dir: .. issues
- Add multi-architecture support for Kind, Docker, kubectl, and Helm
- Fix solo-quick-start script to use correct command
- Ensure proper file copying for npm ci to work

Signed-off-by: belloibrahv <belloibrahv@gmail.com>
- Replace relative dir: .. with dir: {{.TASKFILE_DIR}}/..
- Ensures tasks work correctly when called from root with docker: prefix
- Fixes tsc command not found issue when running from root directory

Signed-off-by: belloibrahv <belloibrahv@gmail.com>
@belloibrahv belloibrahv force-pushed the feat/docker-build-section branch from c84c8a2 to 3d4efbe Compare August 13, 2025 22:18
@belloibrahv
Copy link
Copy Markdown
Contributor Author

@jeromy-cannon ,I have refined this commit with my verified GPG key.

@jeromy-cannon jeromy-cannon merged commit 2578351 into hiero-ledger:main Aug 14, 2025
3 of 4 checks passed
Copy link
Copy Markdown
Contributor

@jeromy-cannon jeromy-cannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved

swirlds-automation added a commit that referenced this pull request Aug 15, 2025
## [0.43.0](v0.42.0...v0.43.0) (2025-08-15)

### Features

* Add kubectl dependency manager ([#2422](#2422)) ([a482302](a482302))
* control block node version as environment variable ([#2472](#2472)) ([c678d90](c678d90))
* Docker build section ([#2433](#2433)) ([2578351](2578351))
* search next available tcp port for port forward function call ([#2362](#2362)) ([22f5a04](22f5a04))

### Bug Fixes

* disable the setting of the gRPC web endpoint when running for apps that are not CN, bump MN to v0.136.0 ([#2463](#2463)) ([16b7cb2](16b7cb2))
* Migrate to using @hiero-ledger/sdk ([#2452](#2452)) ([b9a7018](b9a7018))
* Remove requirement for kind dependency ([#2451](#2451)) ([974303c](974303c))
* update markdown documentation generation script ([#2449](#2449)) ([328544a](328544a))
@swirlds-automation
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.43.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@swirlds-automation
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.43.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Unresolved Comments A pull request where there are comments and they need to be resolved. released on @0.43.x released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants