Skip to content

Conversation

@calintje
Copy link
Contributor

@calintje calintje commented Oct 3, 2025

This PR introduces a Dockerized build system for the Whirlpools repository, aiming to replace the current Nx + Yarn workspaces–based approach. The goal is to make the build process more reliable, reproducible, and accessible across different environments.

Key changes:

  • Adds a Docker Compose–based build pipeline that encapsulates all dependencies and tooling (Rust, Anchor, Node, etc.) within containers.
  • Eliminates local environment dependencies and version mismatches (e.g. solana-sdk, solana-program), improving onboarding for new contributors and external developers.
  • Provides a consistent build environment that behaves the same locally and in CI.
  • Reflects the repository’s directory structure, improving readability and maintainability of the build process.
  • Dockerized build includes formatting

This sets the foundation for future CI/CD integration and ensures that anyone can build the project reliably without complex local setup.

Dependency graph:

build-solana-program ──┐
                       ├─ build-ts-sdk ─────┐
                       ├─ build-legacy-sdk ─┐
                       ├─ build-rust-sdk ───┐
yarn-install ──────────┘                    │
                                            ├─ build-integration
                                            ├─ build-docs
                                            └─ build-examples

Suggested usage:

# Build everything
docker compose --profile build up

# Or build a specific target, e.g. TS SDKs
docker compose --profile build build build-ts-sdk

@calintje calintje changed the title [TKN-702] [WIP] Build project using Docker [TKN-702] Build project using Docker Oct 5, 2025
"@orca-so/whirlpools-program": patch
---

Introduce a Docker-based build environment to improve portability, reproducibility, and onboarding.
Copy link
Member

Choose a reason for hiding this comment

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

Is this bump needed?

Copy link
Contributor Author

@calintje calintje Oct 6, 2025

Choose a reason for hiding this comment

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

The CI requires a changeset, and changesets are be set by project. Would you prefer to remove this changeset and ignore the CI check?

Updated the changeset to reflect the changes made to the actual packages: moved tsup from devdeps to deps for @orca-so/whirlpools and @orca-so/whirlpools-client

Copy link
Member

Choose a reason for hiding this comment

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

You can also add an empty changeset if you don't want a version bump

volumes:
- ./:/usr/src/whirlpools

yarn-install:
Copy link
Member

Choose a reason for hiding this comment

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

Is this yarn intall needed here or can we just run yarn install in the build-ts-sdk container?

Copy link
Contributor Author

@calintje calintje Oct 6, 2025

Choose a reason for hiding this comment

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

The final stages build-integration, build-docs, and build-examples also need yarn install.

The nice thing about having it separate is that yarn-install runs in parallel with build-solana-program (which is a dependency for all other build stages). This reduces build times for build-ts-sdk, build-legacy-sdk and the three final build stages mentioned above.

Copy link
Member

Choose a reason for hiding this comment

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

sgsg if it works it works!

- yarn_cache:/usr/src/whirlpools/.yarn/cache:ro

build-legacy-sdk:
image: rust:1.84.0
Copy link
Member

Choose a reason for hiding this comment

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

I think this one can just use a node image right?

Copy link
Member

Choose a reason for hiding this comment

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

idea: You could also add this to build-ts-sdk (see if that is faster, cleaner, etc.)

Copy link
Contributor Author

@calintje calintje Oct 6, 2025

Choose a reason for hiding this comment

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

I think this one can just use a node image right?

For stability, I wanted to have all containers that rely on yarn install to use the exact same environment. build-docs is an example build stage that relies on yarn install, but also needs Rust to build the rust docs.

idea: You could also add this to build-ts-sdk (see if that is faster, cleaner, etc.)

Both build-ts-sdk and build-legacy-sdk start at the same time in parallel. Since build-legacy-sdk finishes before build-ts-sdk, I concluded that separation is faster than joining the two. The overhead of starting another container is effectively absorbed into the build time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I would be in favor of building our own Docker image and pull it from a registry. The docker image would have all the necessary tools pre-installed:

  • Rust 1.84 (base image)
  • Node 22
  • Yarn 4.6.0
  • Rust clippy and rustfmt

I believe that would speed up things as well. Not sure what the downside would be.

working_dir: /usr/src/whirlpools
command: >
echo "Build Completed"
depends_on:
Copy link
Member

Choose a reason for hiding this comment

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

I would explicitly add all the build containers here and not just the final images (safer in case we change/update something down the line)

volumes:
- ./:/usr/src/whirlpools

yarn-install:
Copy link
Member

Choose a reason for hiding this comment

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

sgsg if it works it works!

@calintje calintje merged commit cb68301 into main Oct 8, 2025
7 checks passed
@calintje calintje deleted the calintje/docker-setup-build branch October 8, 2025 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants