Skip to content
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

Add support for building in a container #3722

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

wwahammy
Copy link
Contributor

@wwahammy wwahammy commented Dec 1, 2024

One of the difficulties I've found in hacking on sandstorm is that that dependencies differ between distributions and between distribution versions. It's not always clear how to get the dependencies for your OS and there's not reliable automated way to do it. For example, right now, our CI only works on Ubuntu 20.04 and it's not clear why.

To address this, this PR adds a simple Python tool (container-build.py) for building Sandstorm in a Docker/OCI container based on Ubuntu 20.04. Currently, the tool only works with Podman. It has three different actions:

  1. prepare : Builds a new container named sandstorm-build on your local machine based on the Dockerfile. The container build process does the following:

    • install the apt packages needed on Ubuntu 20.04
    • Install go 1.2.1
    • Install meteor
    • Set the METEOR_WAREHOUSE_DIR
    • Mount the root of the repo into the container
    • Set the user and group id to 1000 (since that's usually the user and group id of the developer)
  2. shell: Calls prepare and then shells into the sandstorm-build container.

  3. make: Calls prepare and then runs make in the container.

So as long as you have Podman installed, you can run ./container-build.py make at the root of this repo and you will have a built version of Sandstorm. You don't need to have most of the other dependencies installed, you just need podman.

If the actions are followed by additional arguments, those are are added to the end: ./container-build.py make.

Of note: the user permissions in your development directory stay the same when running this tool. It's like if you called make normally.

Some limitations:

  • It only runs on podman. I don't think it would be brutally difficult to use Docker for this but I thought podman might make the permissions a bit easier to work with so I tried that.
  • The documentation needs improving. I didn't want to go through the effort to do that though until I knew this contribution was going to be accepted.

@wwahammy wwahammy force-pushed the container-build-squashed branch from 5cbc09e to 2546ff8 Compare December 1, 2024 22:25
@wwahammy wwahammy changed the title Add container-build tool Add support for building in a container Jan 2, 2025
@wwahammy wwahammy force-pushed the container-build-squashed branch from 25fb206 to 8aa2b1a Compare January 2, 2025 19:41
@wwahammy wwahammy force-pushed the container-build-squashed branch from 8aa2b1a to bb9aeba Compare January 2, 2025 19:44
@wwahammy wwahammy marked this pull request as ready for review January 2, 2025 20:12
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