Skip to content

Conversation

@thoughtpolice
Copy link
Contributor

This reworks the Dockerfile to now build multiple images, including one for end users to run their own copy of Glean, and an updated version of the React demo database. It includes x86_64 and aarch64 Linux images using public GHA runners, which probably covers 98% of all realistic uses. (Using GHA runners means this workflow is trivially usable for public forks, too.)

There is a new bindist target used by the Dockerfile that creates a directory of needed binaries and libraries, and properly packages them for usage in the container.

There are now three containers published from the Dockerfile, all based on Ubuntu 24.04:

  • glean/client, which only contains the glean command, then
  • glean/server, including glean-server, then
  • glean/demo, including a precanned glean-hyperlink + react DB

These containers are all size-optimized; the final images have no development tools installed and the absolute minimum necessary installed packages. For example, the new x86_64 glean/demo is only 486MB uncompressed, compared to the 2.4GB of the previous demo version. The client and server images are 251MB and 300MB, respectively.

The client image should probably include gen-schema so that end users can generate code from their own non-upstream .angle files, but that can be added in a future patch.

In theory, this new container could also be used to replace most of the junk in ci.yml in order to repeat ourselves less, but it would need another image in order to add more things so that the test suite can be run. That can happen in a future patch.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 24, 2025
@netlify
Copy link

netlify bot commented Jan 24, 2025

Deploy Preview for fb-oss-glean ready!

Name Link
🔨 Latest commit f3eb90f
🔍 Latest deploy log https://app.netlify.com/sites/fb-oss-glean/deploys/67a293141e72800007f0ba34
😎 Deploy Preview https://deploy-preview-489--fb-oss-glean.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@simonmar simonmar left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for doing this!

@$(MAKE) -f mk/cxx.mk --no-print-directory CXX_MODE=$(CXX_MODE) CXX_DIR=$(CXX_DIR) $@

GLEAN_CABAL_BINS=glean glean-server glean-hyperlink
GLEAN_NATIVE_LIBS=librocksdb.so.8 libfolly.so.0.58.0-dev libfmt.so.11
Copy link
Collaborator

Choose a reason for hiding this comment

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

this looks fragile, can we make it independent of the version numbers?

Copy link
Contributor Author

@thoughtpolice thoughtpolice Jan 24, 2025

Choose a reason for hiding this comment

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

Maybe we can just do librocksdb.so.* or something like that and let bash do the rest of the magic for us

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 looked into this but it's not quite that simple, because just copying everything with an asterisk copies way too much and bloats up the container again. Instead, I think I'll just make sure that the built docker container has test queries run against it, which should ensure that the proper shared libraries are available (otherwise it wouldn't launch), so at least a break will be obvious and reported.

@thoughtpolice
Copy link
Contributor Author

Note that this still needs to actually push the images to the Docker registry, so it's not quite ready yet.

@thoughtpolice thoughtpolice force-pushed the aseipp/push-zsqoxtmnunrl branch 4 times, most recently from 31bf67a to 925fd19 Compare January 25, 2025 02:22
This reworks the `Dockerfile` to now build multiple images, including
one for end users to run their own copy of Glean, and an updated version
of the React demo database. It includes x86_64 and aarch64 Linux images
using public GHA runners, which probably covers 98% of all realistic
uses. (Using GHA runners means this workflow is trivially usable for
public forks, too.)

There is a new `bindist` target used by the Dockerfile that creates a
directory of needed binaries and libraries, and properly packages them
for usage in the container.

There are now three containers published from the `Dockerfile`, all
based on Ubuntu 24.04:

- `glean/client`, which only contains the `glean` command, then
- `glean/server`, including `glean-server`, then
- `glean/demo`, including a precanned `glean-hyperlink` + react DB

These containers are all size-optimized; the final images have no
development tools installed and the absolute minimum necessary installed
packages. For example, the new x86_64 `glean/demo` is only 486MB
uncompressed, compared to the 2.4GB of the previous demo version. The
`client` and `server` images are 251MB and 300MB, respectively.

The `client` image should probably include `gen-schema` so that end
users can generate code from their own non-upstream `.angle` files, but
that can be added in a future patch.

In theory, this new container could also be used to replace most of the
junk in `ci.yml` in order to repeat ourselves less, but it would need
another image in order to add more things so that the test suite can be
run. That can happen in a future patch.

Signed-off-by: Austin Seipp <[email protected]>
@thoughtpolice thoughtpolice force-pushed the aseipp/push-zsqoxtmnunrl branch from 925fd19 to f3eb90f Compare February 4, 2025 22:22
@thoughtpolice
Copy link
Contributor Author

FYI, I'm still working on this, but it turns out figuring out how to push a multi-arch docker manifest to ghcr.io is somehow little trodden territory.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants