Crates.io | ocipkg |
lib.rs | ocipkg |
version | 0.3.8 |
source | src |
created_at | 2022-07-23 15:16:21.058217 |
updated_at | 2024-06-05 09:38:08.022419 |
description | OCI registry for package distribution |
homepage | |
repository | https://github.com/termoshtt/ocipkg |
max_upload_size | |
id | 631470 |
size | 99,373 |
OCI Registry for package distribution.
ocipkg is designed as a thin OCI registry client:
In addition, ocipkg provides utilities for using OCI registry for package distribution:
Cargo.toml
metadata.build.rs
helper for getting and linking library file (*.a
or *.so
) as a containerI have determined to start this project while writing FFI crate in Rust. The problem is "how to get a share/static library linked to FFI crate". This is the problem bothered me and prevent from creating portable C++ library.
We have three options:
*-sys
crate support this option.cmake
, is required in user system,
and requires additional build resources.*-src
.x86_64-unknown-linux-gnu
, x86_64-pc-windows-msvc
, aarch64-unknown-linux-gnu
,...ocipkg focuses on the option 3., i.e. helping distributing binary compiled by the developer through OCI registry.
Rust
C++/cmake
cargo install ocipkg-cli
ocipkg
commandTBW
cargo-ocipkg
commandA tool for creating and publishing container consists of
static or dynamic library built by cargo build
:
$ cargo ocipkg build --release
Finished release [optimized] target(s) in 0.00s
Creating oci-archive (/home/teramura/github.com/termoshtt/ocipkg/examples/dynamic/rust/lib/target/release/ocipkg_dd0c7a812fd0fcbc.tar)
The filename is in form of ocipkg_{{ hash }}.tar
,
and this hash is calculated from image name and Cargo.toml
.
Container image name is determined using git commit hash
as {{ registry }}:$(git rev-parse HEAD --short)
where registry name is set by Cargo.toml
:
[package.metadata.ocipkg]
registry = "ghcr.io/termoshtt/ocipkg/dynamic/rust"
This container can be published by cargo-ocipkg publish
:
$ cargo ocipkg publish --release
Publish container (ghcr.io/termoshtt/ocipkg/dynamic/rust:be7f108)
Open Container Initiative (OCI) is a project under Linux Foundation.
This project does not depend on OCI Runtime specification since we never run a container.
The idea that distribute any files (not a system image) using OCI registry is based on ORAS.
Similar projects trying to distribute packages using OCI registries:
© 2020 Toshiki Teramura (@termoshtt)
This project is licensed under either of
at your option.