Skip to content

fix(docker): auto-build sdk & hub in build.rs #1972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

NathanFlurry
Copy link
Member

Changes

Copy link

cloudflare-workers-and-pages bot commented Jan 30, 2025

Deploying rivet-hub with  Cloudflare Pages  Cloudflare Pages

Latest commit: 60c5a95
Status: ✅  Deploy successful!
Preview URL: https://24d1d03e.rivet-hub-7jb.pages.dev
Branch Preview URL: https://01-29-fix-docker-auto-build.rivet-hub-7jb.pages.dev

View logs

Copy link
Member Author

NathanFlurry commented Jan 30, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR implements significant changes to the build system and Docker configuration. Here's a summary of the key modifications:

  • Introduces a new build ID system using timestamp+UUID instead of Git-based versioning across the hub application
  • Enhances build script visibility by capturing and displaying yarn command outputs in build.rs files
  • Modifies Docker configuration to support Node.js 22.x and adds caching for node dependencies

Key points to address:

  • Hardcoded FontAwesome package token in Dockerfile needs to be removed (marked as TODO)
  • Incorrect ENTRYPOINT commands in Dockerfile for isolate-v8-runner and container-runner stages using 'rivet-client'
  • Duplicate package installations in Dockerfile's apt-get commands need consolidation
  • Removal of Git-based versioning could impact development debugging capabilities
  • The new build ID system may cause unnecessary cache invalidation since it changes on every build

14 file(s) reviewed, 10 comment(s)
Edit PR Review Bot Settings | Greptile

!docker/monolith
docker/monolith/*.md
# Rust
**/target
Copy link

Choose a reason for hiding this comment

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

style: Duplicate target ignore pattern (appears again on line 16). Remove one instance.

Suggested change
**/target
**/target/

Comment on lines +12 to +17
**/.turbo
**/.yarn
**/dist/
**/node_modules/
**/target
.turbo
Copy link

Choose a reason for hiding this comment

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

style: Duplicate .turbo ignore pattern. Remove one instance.

Suggested change
**/.turbo
**/.yarn
**/dist/
**/node_modules/
**/target
.turbo
**/.turbo
**/.yarn
**/dist/
**/node_modules/
**/target

Comment on lines 8 to +16
**/target
**/target/
**/*.rustfmt

# JavaScript
**/.cache/
**/.turbo
**/.yarn
**/dist/
**/node_modules/
**/target
Copy link

Choose a reason for hiding this comment

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

style: Duplicate **/target entries (lines 8 and 16). One of these should be removed to avoid confusion.

Suggested change
**/target
**/target/
**/*.rustfmt
# JavaScript
**/.cache/
**/.turbo
**/.yarn
**/dist/
**/node_modules/
**/target
**/target
# JavaScript
**/.cache/
**/.turbo
**/.yarn
**/dist/
**/node_modules/

Comment on lines +16 to 17
**/target
.turbo
Copy link

Choose a reason for hiding this comment

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

style: Redundant .turbo entry. Already covered by **/.turbo on line 12.

Suggested change
**/target
.turbo
**/target

ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0

# TODO: REMOVE
ENV FONTAWESOME_PACKAGE_TOKEN=E7A94808-3467-4150-B90D-EABDAEB9E0B4
Copy link

Choose a reason for hiding this comment

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

logic: Remove hardcoded FontAwesome token - this should be passed as a build arg or through a secrets mount

Suggested change
ENV FONTAWESOME_PACKAGE_TOKEN=E7A94808-3467-4150-B90D-EABDAEB9E0B4
ARG FONTAWESOME_PACKAGE_TOKEN
ENV FONTAWESOME_PACKAGE_TOKEN=${FONTAWESOME_PACKAGE_TOKEN}

@@ -10,7 +10,7 @@ initThirdPartyProviders();
rivetClient.cloud
.bootstrap()
.then((response) => {
run({ cacheKey: [response.deployHash, __APP_GIT_COMMIT__].join("-") });
run({ cacheKey: [response.deployHash, __APP_BUILD_ID__].join("-") });
Copy link

Choose a reason for hiding this comment

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

style: This cache key will now change on every build instead of being tied to Git commits. Could cause more frequent cache invalidation than necessary in production.

Comment on lines +43 to +46
__APP_BUILD_ID__: JSON.stringify(
`${new Date().toISOString()}@${crypto.randomUUID()}`,
),
Copy link

Choose a reason for hiding this comment

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

style: Build ID changes on every build, may cause excessive cache invalidation. Consider using a more stable identifier for development

Comment on lines +6 to +9
assert!(
yarn_check.is_ok() && yarn_check.unwrap().success(),
"yarn is not installed, please install yarn to build this project"
);
Copy link

Choose a reason for hiding this comment

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

logic: unwrap() on yarn_check could panic if yarn_check.is_ok() is false. Consider using if-else logic instead of assert for better error handling.

Suggested change
assert!(
yarn_check.is_ok() && yarn_check.unwrap().success(),
"yarn is not installed, please install yarn to build this project"
);
if let Ok(status) = yarn_check {
if !status.success() {
return Err("yarn is installed but not working properly".into());
}
} else {
return Err("yarn is not installed, please install yarn to build this project".into());
}

Comment on lines 45 to 49
fs_extra::dir::copy(
dist_path,
dist_path.clone(),
out_dir,
&fs_extra::dir::CopyOptions::new().overwrite(true),
&fs_extra::dir::CopyOptions::new().content_only(true),
)?;
Copy link

Choose a reason for hiding this comment

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

style: dist_path.clone() is unnecessary since PathBuf is moved in the fs_extra::dir::copy call and not used afterwards

Suggested change
fs_extra::dir::copy(
dist_path,
dist_path.clone(),
out_dir,
&fs_extra::dir::CopyOptions::new().overwrite(true),
&fs_extra::dir::CopyOptions::new().content_only(true),
)?;
fs_extra::dir::copy(
dist_path,
out_dir,
&fs_extra::dir::CopyOptions::new().content_only(true),
)?;

Copy link

Choose a reason for hiding this comment

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

logic: Removing all gitignore rules from generated directory could cause build artifacts and temporary files to be tracked. Consider keeping at least some exclusion rules.

Suggested change
*
!.gitignore
!errorPages.json
!apiPages.json
!meta.json

Copy link

cloudflare-workers-and-pages bot commented Jan 30, 2025

Deploying rivet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 60c5a95
Status:⚡️  Build in progress...

View logs

@NathanFlurry NathanFlurry force-pushed the 01-29-fix_docker_auto-build_sdk_hub_in_build.rs branch from c755e19 to ee5a532 Compare January 30, 2025 07:33
@NathanFlurry NathanFlurry force-pushed the 01-29-fix_docker_auto-build_sdk_hub_in_build.rs branch from ee5a532 to 60c5a95 Compare January 30, 2025 08:38
@NathanFlurry NathanFlurry changed the base branch from docs_add_cd_site_to_dev_instructions to 01-30-fix_hub_allow_clicking_continue_button_with_only_one_project_in_local_dev January 30, 2025 08:38
Copy link
Contributor

graphite-app bot commented Jan 30, 2025

Merge activity

  • Jan 30, 3:38 AM EST: A user added this pull request to the Graphite merge queue.
  • Jan 30, 3:43 AM EST: CI is running for this PR on a draft PR: #1974
  • Jan 30, 3:45 AM EST: A user merged this pull request with the Graphite merge queue via draft PR: #1974.

NathanFlurry added a commit that referenced this pull request Jan 30, 2025
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
@graphite-app graphite-app bot closed this Jan 30, 2025
@graphite-app graphite-app bot deleted the 01-29-fix_docker_auto-build_sdk_hub_in_build.rs branch January 30, 2025 08:45
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.

1 participant