-
Notifications
You must be signed in to change notification settings - Fork 7
distribution/Dockerfile-ubi: add containerfile for bootc-foundry #11
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ca6130d
containerfiles: move containers to subdirectory
croissanne dd42d3b
distribution/Dockerfile-ubi: add containerfile for bootc-foundry
croissanne 5951f5e
.gitlab-ci.yml: test builds in which uses the builder container
croissanne 4464f5d
schutzbot/build: use force copy on temporary containerfile
croissanne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| FROM registry.access.redhat.com/ubi10/ubi-minimal:latest | ||
|
|
||
| RUN microdnf install -y buildah python3 | ||
|
|
||
| RUN mkdir /containerfiles | ||
| COPY ./containerfiles/Containerfile* /containerfiles/ | ||
|
|
||
| # rely on CI scripts for now | ||
| COPY ./schutzbot /schutzbot | ||
|
|
||
| COPY ./distribution/entrypoint.py /opt/entrypoint.py | ||
| ENTRYPOINT ["/opt/entrypoint.py"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| #!/usr/bin/python3 | ||
|
|
||
| import argparse | ||
| import os | ||
| import subprocess | ||
| import sys | ||
|
|
||
| # hardcoded build matrix for now | ||
| BUILD_MATRIX = { | ||
| "centos-9": { | ||
| "from": "quay.io/centos-bootc/centos-bootc:stream9", | ||
| "dst": "centos-bootc:stream9", | ||
| "containerfile": "el9", | ||
| }, | ||
| "centos-10": { | ||
| "from": "quay.io/centos-bootc/centos-bootc:stream10", | ||
| "dst": "centos-bootc:stream10", | ||
| "containerfile": "el10", | ||
| }, | ||
| "rhel-9.7": { | ||
| "from": "registry.redhat.io/rhel9/rhel-bootc:9.7", | ||
| "from_creds": os.getenv("RH_CREDS"), | ||
| "dst": "rhel-bootc:9.7", | ||
| "containerfile": "el9", | ||
| }, | ||
| "rhel-10.1": { | ||
| "from": "registry.redhat.io/rhel10/rhel-bootc:10.1", | ||
| "from_creds": os.getenv("RH_CREDS"), | ||
| "dst": "rhel-bootc:10.1", | ||
| "containerfile": "el10", | ||
| }, | ||
| } | ||
|
|
||
|
|
||
| def run_one(build, repo): | ||
| env = os.environ.copy() | ||
| env["FROM_REF"] = build["from"] | ||
| env["DST_REF"] = f"{repo}/{build['dst']}" | ||
| env["CONTAINERFILE"] = build["containerfile"] | ||
| if build.get("from_creds"): | ||
| env["FROM_CREDS"] = build["from_creds"] | ||
|
|
||
| print(f""" | ||
| Running /schutzbot/build.sh with: | ||
| FROM_REF: {env['FROM_REF']} | ||
| DST_REF: {env['DST_REF']} | ||
| CONTAINERFILE: {env['CONTAINERFILE']} | ||
| FROM_CREDS present: {'yes' if 'FROM_CREDS' in env else 'no'}""") | ||
|
|
||
| subprocess.run([ | ||
| "/schutzbot/build.sh", | ||
| ], env=env, shell=True, stderr=subprocess.STDOUT, check=True) | ||
|
|
||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser( | ||
| prog="bootc-foundry container entrypoint", | ||
| description="Build bootc containers inside container", | ||
| ) | ||
| parser.add_argument( | ||
| "--repo", | ||
| dest="repo", | ||
| type=str, | ||
| required=True, | ||
| help="repository to push derived containers to", | ||
| ) | ||
| parser.add_argument( | ||
| "--distro", | ||
| help="only build specified distros", | ||
| required=False, | ||
| type=str, | ||
| default=[], | ||
| action="append", | ||
| ) | ||
| args = parser.parse_args(sys.argv[1:]) | ||
|
|
||
| for distro, build in BUILD_MATRIX.items(): | ||
| if args.distro and distro not in args.distro: | ||
| continue | ||
| run_one(build, args.repo) | ||
|
|
||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
| CONTAINER=$(podman build -f distribution/Dockerfile-ubi . | tail -n 1) | ||
| podman run -e PYTHONUNBUFFERED=1 -e RH_CREDS="${RH_CREDS:-}" "$CONTAINER" --repo placeholder.org --distro "$1" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.