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

Dockerfile for census builder #267

Merged
merged 3 commits into from
Mar 17, 2023
Merged

Dockerfile for census builder #267

merged 3 commits into from
Mar 17, 2023

Conversation

ebezzi
Copy link
Member

@ebezzi ebezzi commented Mar 16, 2023

Dockerfile that can be used for platform independent census builds.

Usage:

  1. Build with:
docker build --build-arg=COMMIT_SHA=$(git rev-parse --short HEAD) . -t census-builder
  1. Modify the build-census.yaml file to include options and build commands. An example is included that runs the builder with a manifest file.

  2. Run with:

docker run --mount type=bind,source="$(pwd)/data",target=/data census-builder

The mount is necessary so that the built census can be retrieved and uploaded to S3 later.

entrypoint.sh Outdated
@@ -0,0 +1,3 @@
#!/bin/bash
Copy link
Member Author

Choose a reason for hiding this comment

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

This file is no longer necessary, but I included it as an example if we wanted a simplified build process (without the yaml file)

entrypoint.py Outdated
subcommand_args.append(cmd)
add_args(opts, subcommand_args)
print(subcommand_args)
subprocess.call(subcommand_args)
Copy link
Member Author

Choose a reason for hiding this comment

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

Instead of calling subprocess, we could modify the builder so that it could be called directly. This would require, at minimum, to modify the main function to accept a Namespace, but I think for now I'd like to validate this approach before we make major changes.

@@ -134,6 +134,12 @@ def get_git_commit_sha() -> str:
"""
Returns the git commit SHA for the current repo
"""
# Try to get the git commit SHA from the COMMIT_SHA env variable
commit_sha_var = os.getenv("COMMIT_SHA")
Copy link
Member Author

Choose a reason for hiding this comment

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

This is necessary because we don't want the .git folder to be in the Docker image, so we need to pass the commit SHA externally.

@codecov
Copy link

codecov bot commented Mar 16, 2023

Codecov Report

Merging #267 (be91bba) into main (22092be) will decrease coverage by 0.09%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##             main     #267      +/-   ##
==========================================
- Coverage   93.52%   93.44%   -0.09%     
==========================================
  Files          34       34              
  Lines        2023     2028       +5     
==========================================
+ Hits         1892     1895       +3     
- Misses        131      133       +2     
Flag Coverage Δ
unittests 93.44% <66.66%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tools/cell_census_builder/util.py 88.31% <66.66%> (-1.97%) ⬇️

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@bkmartinjr bkmartinjr left a comment

Choose a reason for hiding this comment

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

This looks good to me as a starting point. I can easily wire it up to the builder package.

thanks!

@ebezzi ebezzi merged commit 0b07cb8 into main Mar 17, 2023
@ebezzi ebezzi deleted the ebezzi/base-dockerfile branch March 17, 2023 20:55
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.

2 participants