https://github.com/containers/buildsourceimage
Tool to build a source image based on an existing OCI image
https://github.com/containers/buildsourceimage
Last synced: 2 months ago
JSON representation
Tool to build a source image based on an existing OCI image
- Host: GitHub
- URL: https://github.com/containers/buildsourceimage
- Owner: containers
- License: gpl-2.0
- Created: 2019-07-12T18:36:51.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-03-24T16:12:27.000Z (3 months ago)
- Last Synced: 2025-04-02T09:47:27.911Z (2 months ago)
- Language: Shell
- Size: 172 KB
- Stars: 30
- Watchers: 4
- Forks: 14
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE-OF-CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
[](https://cirrus-ci.com/github/containers/BuildSourceImage/master)
[](https://quay.io/repository/ctrs/bsi)# BuildSourceImage
Tool to build a source image.
The goal is to make retrieving the source code used to make a container image
easier for users to obtain, using the standard OCI protocols and image formats.## Usage
```bash
$> ./BuildSourceImage.sh -h
BuildSourceImage.sh version 0.1
Usage: BuildSourceImage.sh [-D] [-b ] [-c ] [-e ] [-r ] [-o ] [-p ] [-l] [-d ]-b base path for source image builds
-c build context for the container image. Can be provided via CONTEXT_DIR env variable
-e extra src for the container image. Can be provided via EXTRA_SRC_DIR env variable
-s directory of SRPMS to add. Can be provided via SRPM_DIR env variable
-o output the OCI image to path. Can be provided via OUTPUT_DIR env variable
-d enumerate specific source drivers to run
-l list the source drivers available
-p push source image to specified reference after build
-D debuging output. Can be set via DEBUG env variable
-h this usage information
-v version```
Nicely usable inside a container:
```bash
$> mkdir ./output/
$> podman run -it -v $(pwd)/output/:/output/ -v $(pwd)/SRCRPMS/:/data/ -u $(id -u) quay.io/ctrs/bsi -s /data/ -o /output/
```## Examples
* Building from a fetched reference [](https://asciinema.org/a/266340)
* Building from a directory of src.rpms: [](https://asciinema.org/a/266341)
* Building from a directory of src.rpms and pushing it to a simple registry: [](https://asciinema.org/a/266343)## Use Cases
* Build a source image from an existing container image by introspection
* Build a source code image from a collection of known `.src.rpm`'s
* Include additional build context into the source image
* Include extra sources use