1
0
mirror of https://github.com/containers/youki synced 2024-11-26 06:08:07 +01:00

Update doc with cross-rs and musl builds (#2621)

Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
This commit is contained in:
Jorge Prendes 2024-01-11 11:39:29 +00:00 committed by GitHub
parent 6271537503
commit 60dfbaa0d4
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 18 deletions

@ -6,16 +6,35 @@ Youki currently only supports Linux Platform, and to use it on other platform yo
Also note that Youki currently only supports and expects systemd as init system, and would not work on other systems. There is currently work on-going to put systemd dependent features behind a feature flag, but till then you will need a systemd enabled system to work with Youki. Also note that Youki currently only supports and expects systemd as init system, and would not work on other systems. There is currently work on-going to put systemd dependent features behind a feature flag, but till then you will need a systemd enabled system to work with Youki.
## Requirements ## Build Requirements
As Youki is written in Rust, you will need to install and setup Rust toolchain to compile it. The instructions for that can be found on Rust's official site [here](https://www.rust-lang.org/tools/install). As Youki is written in Rust, you will need to install and setup Rust toolchain to compile it. The instructions for that can be found on Rust's official site [here](https://www.rust-lang.org/tools/install).
If you installed it using rustup, the correct compiler version will be setup automatically from `rust-toolchain.toml` in the repo root.
You can use Youki by itself to start and run containers, but it can be a little tedious, as it is a low-level container runtime. You can use a High-level container runtime, with its runtime set to Youki, so that it will be easier to use. Both of these are explained in the [Basic Usage](./basic_usage.md). For using it along with an high-level runtime, you will to install one such as Docker or Podman. This documentation uses Docker in its examples, which can be installed from [here](https://docs.docker.com/engine/install). ### Build with cross-rs
To compile and run, Youki itself depends on some underlying libraries being installed. You can install them using your respective package manager as shown below. You can compile youki using [cross-rs](https://github.com/cross-rs/cross), which provides:
* Seamless compilation for different architectures (see `Cross.toml` in the repo root for the list of supported targets)
* No build time dependencies (compilation runs in a container)
* No runtime dependencies when building static binaries (musl targets)
### Debian, Ubuntu and related distributions The only build dependency is [cross-rs](https://github.com/cross-rs/cross?tab=readme-ov-file#installation) and its [dependencies](https://github.com/cross-rs/cross?tab=readme-ov-file#dependencies) (rustup and docker or podman).
```console
$ CARGO=cross TARGET=musl just youki-dev # or youki-release
```
### Build without cross-rs
Install the build dependencies and then run:
```console
$ just youki-dev # or youki-release
```
Install the build dependencies using your distribution's package manger
#### Debian, Ubuntu and related distributions
```console ```console
$ sudo apt-get install \ $ sudo apt-get install \
pkg-config \ pkg-config \
@ -27,8 +46,7 @@ $ sudo apt-get install \
libssl-dev libssl-dev
``` ```
### Fedora, CentOS, RHEL and related distributions #### Fedora, CentOS, RHEL and related distributions
```console ```console
$ sudo dnf install \ $ sudo dnf install \
pkg-config \ pkg-config \
@ -39,20 +57,33 @@ $ sudo dnf install \
openssl-devel openssl-devel
``` ```
## Runtime requirements
The static binary (musl) builds of youki have no additional runtime requirements. Otherwise you need to install the runtime requirements using your distribution's package manager:
#### Debian, Ubuntu and related distributions
```console
$ sudo apt-get install libseccomp2
```
#### Fedora, CentOS, RHEL and related distributions
```console
$ sudo dnf install libseccomp
```
## Running youki
You can use Youki by itself to start and run containers, but it can be a little tedious, as it is a low-level container runtime. You can use a High-level container runtime, with its runtime set to Youki, so that it will be easier to use. Both of these are explained in the [Basic Usage](./basic_usage.md). For using it along with an high-level runtime, you will to install one such as Docker or Podman. This documentation uses Docker in its examples, which can be installed from [here](https://docs.docker.com/engine/install).
--- ---
## Quick install ## Quick install
Install from the GitHub release. Install from the GitHub release as root:
Note that this way also requires the aforementioned installation.
<!--youki release begin--> <!--youki release begin-->
```console ```console
$ wget -qO youki-0.3.1.tar.gz https://github.com/containers/youki/releases/download/v0.3.1/youki-0.3.1-$(uname -m).tar.gz # curl -sSfL https://github.com/containers/youki/releases/download/v0.3.1/youki-0.3.1-$(uname -m)-musl.tar.gz | tar -xzvC /usr/bin/ youki
$ tar -zxvf youki-0.3.1.tar.gz youki
# Maybe you need root privileges.
$ mv youki /usr/local/bin/youki
$ rm youki-0.3.1.tar.gz
``` ```
<!--youki release end--> <!--youki release end-->

@ -42,6 +42,22 @@ if [ "${VERSION}" = release ]; then
OPTION="--release" OPTION="--release"
fi fi
# expand target shortcuts
case "$TARGET" in
musl)
TARGET="$(uname -m)-unknown-linux-musl"
;;
gnu|glibc)
TARGET="$(uname -m)-unknown-linux-gnu"
;;
arm64|aarch64)
TARGET="aarch64-unknown-linux-musl"
;;
amd64|x86_64)
TARGET="x86_64-unknown-linux-musl"
;;
esac
FEATURES=() FEATURES=()
if [ -n "${features}" ]; then if [ -n "${features}" ]; then
FEATURES=("--features=${features}") FEATURES=("--features=${features}")

@ -13,11 +13,7 @@ END_MARKER="<!--youki release end-->"
echo "\`\`\`console echo "\`\`\`console
\$ wget -qO youki-${VERSION}.tar.gz https://github.com/containers/youki/releases/download/v${VERSION}/youki-${VERSION}-\$(uname -m).tar.gz # curl -sSfL https://github.com/containers/youki/releases/download/v${VERSION}/youki-${VERSION}-\$(uname -m)-musl.tar.gz | tar -xzvC /usr/bin/ youki
\$ tar -zxvf youki-${VERSION}.tar.gz youki
# Maybe you need root privileges.
\$ mv youki /usr/local/bin/youki
\$ rm youki-${VERSION}.tar.gz
\`\`\`" > replace_content.txt \`\`\`" > replace_content.txt
awk -v start="$START_MARKER" -v end="$END_MARKER" -v newfile="replace_content.txt" ' awk -v start="$START_MARKER" -v end="$END_MARKER" -v newfile="replace_content.txt" '