{"id":13647909,"url":"https://github.com/bazel-contrib/rules_oci","last_synced_at":"2025-04-22T06:32:21.674Z","repository":{"id":44659912,"uuid":"436915688","full_name":"bazel-contrib/rules_oci","owner":"bazel-contrib","description":"Bazel rules for building OCI containers","archived":false,"fork":false,"pushed_at":"2025-04-21T17:24:41.000Z","size":4876,"stargazers_count":325,"open_issues_count":60,"forks_count":174,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-21T18:33:06.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bazel-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"bazel-rules-authors-sig"}},"created_at":"2021-12-10T09:06:52.000Z","updated_at":"2025-04-21T17:24:45.000Z","dependencies_parsed_at":"2024-02-27T03:24:53.826Z","dependency_job_id":"6ffdb5a2-f0d5-40a5-aef1-6f45d7df3c4a","html_url":"https://github.com/bazel-contrib/rules_oci","commit_stats":null,"previous_names":[],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazel-contrib%2Frules_oci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazel-contrib%2Frules_oci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazel-contrib%2Frules_oci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazel-contrib%2Frules_oci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazel-contrib","download_url":"https://codeload.github.com/bazel-contrib/rules_oci/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250183349,"owners_count":21388701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:03:49.906Z","updated_at":"2025-04-22T06:32:21.668Z","avatar_url":"https://github.com/bazel-contrib.png","language":"Starlark","readme":"# Bazel rules for OCI container images\n\nBazel rules based on the Open Containers Initiative: \u003chttps://opencontainers.org/\u003e\n\nPlease let us know about your success stories on our adoption discussion!\n\u003chttps://github.com/bazel-contrib/rules_oci/discussions/299\u003e\n\n_Need help?_ This ruleset has support provided by [Aspect Build](https://www.aspect.build/services).\n\n## Comparison with rules_docker\n\nThis ruleset is not intended as a complete replacement for [rules_docker].\nMost use cases can be accomodated, and we know many users who have completely replaced rules_docker.\nHowever, some other use cases such as `container_run_and*\\*` rules have no equivalent.\nYou might still decide to use rules_docker, and perhaps even volunteer to help maintain it.\n\nYou can find a migration guide at \u003chttps://docs.aspect.build/guides/rules_oci_migration\u003e.\n\n## Design\n\nWe started from first principles and avoided some pitfalls we learned from rules_docker:\n\n- Use a toolchain consisting of off-the-shelf, pre-built layer and container manipulation tools.\n- Don't write language-specific rules, as we cannot be experts on all languages, nor can users deal with the versioning issues\n  that come with dependencies we would be forced to take on the rules for those languages.\n- Don't be docker-specific, now that it has a commercial license and other container runtimes exist ([podman](https://podman.io/) for example).\n- Use our toolchain hermetically: don't assume there is a docker pre-installed on the machine.\n- Keep a tight complexity budget for the project so we are able to commit to effective maintenance.\n\n[rules_docker]: https://github.com/bazelbuild/rules_docker\n\n## Installation\n\nSee the install instructions on the release notes: \u003chttps://github.com/bazel-contrib/rules_oci/releases\u003e\n\nTo use a commit rather than a release, you can point at any SHA of the repo.\n\nWith bzlmod, you can use `archive_override` or `git_override`. For `WORKSPACE`, you modify the `http_archive` call; for example to use commit `abc123` with a `WORKSPACE` file:\n\n1. Replace `url = \"https://github.com/bazel-contrib/rules_oci/releases/download/v0.1.0/rules_oci-v0.1.0.tar.gz\"`\n   with a GitHub-provided source archive like `url = \"https://github.com/bazel-contrib/rules_oci/archive/abc123.tar.gz\"`\n1. Replace `strip_prefix = \"rules_oci-0.1.0\"` with `strip_prefix = \"rules_oci-abc123\"`\n1. Update the `sha256`. The easiest way to do this is to comment out the line, then Bazel will\n   print a message with the correct value.\n\n\u003e Note that GitHub source archives don't have a strong guarantee on the sha256 stability, see\n\u003e \u003chttps://github.blog/2023-02-21-update-on-the-future-stability-of-source-code-archives-and-hashes\u003e\n\n## Usage\n\nrules_oci does not contain language-specific rules, but we do have limited documentation on how to accomplish typical tasks.\n\n- [C/C++](docs/cpp.md)\n- [Go](docs/go.md)\n- [Java](docs/java.md)\n- [JavaScript](docs/javascript.md)\n- [Python](docs/python.md)\n- [Rust](docs/rust.md)\n- [Scala](docs/scala.md)\n- [WASM](https://github.com/bazel-contrib/rules_oci/tree/main/e2e/wasm) (see https://docs.docker.com/desktop/wasm/)\n- [Static Content](docs/static_content.md) (such as a html/javascript frontend)\n\n\u003e [!NOTE]\n\u003e Your language not listed above? Please contribute engineering resources or financially through our Sponsor link!\n\nThere are some generic examples of usage in the [examples](https://github.com/bazel-contrib/rules_oci/tree/main/examples) folder.\nNote that these examples rely on the setup code in the `/WORKSPACE` file in the root of this repo.\n\n## Public API Docs\n\n### Install system packages\n\n- Alpine: we recommend \u003chttps://github.com/chainguard-dev/rules_apko\u003e to install [apk](https://wiki.alpinelinux.org/wiki/Package_management) packages.\n- Debian: we recommend \u003chttps://github.com/GoogleContainerTools/rules_distroless\u003e to install [deb](https://www.debian.org/distrib/packages) packages.\n- RHEL/CentOS/Amazon Linux: we don't have any support for this yet. Please consider donating to the project!\n\n### Construct image layers\n\n- [oci_image](docs/image.md) Build an OCI compatible container image.\n- [oci_image_index](docs/image_index.md) Build a multi-architecture OCI compatible container image.\n- [oci_load](docs/load.md) Loads an `oci_image` into a container daemon. Can optionally produce a loadable tarball.\n\n### Pull and Push\n\n- [oci_pull](docs/pull.md) Pull image layers using Bazel's downloader. Falls back to using `curl` in some cases.\n- [oci_push](docs/push.md) Push an `oci_image` or `oci_image_index` to a remote registry.\n\n### Testing\n\n- We recommend [container_structure_test](https://github.com/GoogleContainerTools/container-structure-test#running-structure-tests-through-bazel) to run tests\n\n### Signing\n\n\u003e [!WARNING]  \n\u003e Signing images is a developer preview, not part of public API yet.\n\n- [cosign_sign](https://github.com/bazel-contrib/rules_oci/blob/main/cosign/private/sign.bzl): Sign an `oci_image` using `cosign` binary at a remote registry.\n- [cosign_attest](https://github.com/bazel-contrib/rules_oci/blob/main/cosign/private/attest.bzl) Add an attachment to an `oci_image` at a remote registry using `cosign`.\n\n### 3rd Party Extensions/Tools\n\n- [ociupdate](https://github.com/theoremlp/ociupdate): CLI and basic module extension to help with automating updates to image digests for ECR-based images with immutable tags.\n","funding_links":["https://opencollective.com/bazel-rules-authors-sig"],"categories":["Starlark"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazel-contrib%2Frules_oci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazel-contrib%2Frules_oci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazel-contrib%2Frules_oci/lists"}