Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,31 @@ make clean
make docker.io/library/<distro>:<version> [docker.io/library/<distro>:<version> ...]

# for example:
# make docker.io/library/centos:7
# make docker.io/library/ubuntu:jammy
# make quay.io/centos/centos:stream9
# make docker.io/library/ubuntu:24.04
```

After build completes, packages can be found in the `build` directory.

## Specifying the version to build

By default, packages are built from HEAD of the `release/1.7` branch, as
defines in [common/common.mk]. The version of runc defaults to the version
as specified by the containerd project through the [script/setup/runc-version]
file in the containerd repository.

Use the `REF` and `RUNC_REF` make variables to specify the versions to build.
The provided values must be a valid Git reference, which can be a commit
(e.g., `ae71819` or `ae71819c4f5e67bb4d5ae76a6b735f29cc25774e`), branch
(e.g. `main` or `release/1.7`), or tag (e.g. `v1.7.18`).

The following example builds packages for containerd v1.7.18 with
runc v1.1.12 for Ubuntu 24.04:

```bash
make REF=v1.7.18 RUNC_REF= docker.io/library/ubuntu:24.04
```

## Building a package from a local source directory

Specify the path to the local source directory using `CONTAINERD_DIR` and/or
Expand All @@ -35,3 +54,7 @@ make REF=HEAD CONTAINERD_DIR=/home/me/go/src/github.com/containerd/containerd do

* [deb package maintainers guide](debian/README.md)
* [rpm package maintainers guide](rpm/README.md)


[common/common.mk]: https://github.com/docker/containerd-packaging/blob/main/common/common.mk#L19
[script/setup/runc-version]: https://github.com/containerd/containerd/blob/v1.7.18/script/setup/runc-version
6 changes: 3 additions & 3 deletions debian/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repository.
Afterwards test if you can actually build the release with (for example):

```bash
make REF=${TAG} docker.io/library/ubuntu:jammy
make REF=${TAG} docker.io/library/ubuntu:24.04
```

If you can actually build the package then start prepping
Expand All @@ -31,11 +31,11 @@ VERSION is already there.
Releases can then be built with:

```bash
make REF=${TAG} docker.io/library/ubuntu:jammy
make REF=${TAG} docker.io/library/ubuntu:24.04
```

or

```bash
make REF=${TAG} BUILD_IMAGE=docker.io/library/ubuntu:jammy
make REF=${TAG} BUILD_IMAGE=docker.io/library/ubuntu:24.04
```
6 changes: 1 addition & 5 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ Source: containerd.io
Section: devel
Priority: optional
Maintainer: Containerd team <help@containerd.io>
# btrfs dependencies no longer needed for containerd 1.7 and up, which now
# uses the Linux kernel headers for this.
# TODO(thaJeztah): remove btrfs build-dependencies once containerd 1.6 reaches EOL.
Build-Depends: libbtrfs-dev | btrfs-tools ,
debhelper (>= 10~) | dh-systemd,
Build-Depends: debhelper (>= 10~) | dh-systemd,
pkg-config,
libseccomp-dev
Standards-Version: 4.1.4
Expand Down
6 changes: 3 additions & 3 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ endif
# TODO remove custom PREFIX variable once containerd release/1.4 and release/1.5
# are obsolete. See https://github.com/containerd/containerd/commit/b5f530a157
binaries: ## Create containerd binaries
@set -x; GO111MODULE=auto make -C $(GO_SRC_PATH) --no-print-directory \
@set -x; make -C $(GO_SRC_PATH) --no-print-directory \
DESTDIR="$$(pwd)" \
PREFIX="" \
VERSION=$${VERSION} \
Expand All @@ -44,12 +44,12 @@ binaries: ## Create containerd binaries
rm -f bin/containerd-stress

bin/runc:
@set -x; GO111MODULE=auto make -C /go/src/github.com/opencontainers/runc --no-print-directory \
@set -x; make -C /go/src/github.com/opencontainers/runc --no-print-directory \
BINDIR="$$(pwd)/bin" \
runc install

man: ## Create containerd man pages
@set -x; GO111MODULE=auto make -C $(GO_SRC_PATH) --no-print-directory man
@set -x; make -C $(GO_SRC_PATH) --no-print-directory man

# copy the generated man pages instead of using "make install-man" to allow
# dh_installman doing its magic
Expand Down
2 changes: 0 additions & 2 deletions dockerfiles/deb.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ FROM ${GOLANG_IMAGE} AS golang

FROM golang AS go-md2man
ARG GOPROXY=direct
ARG GO111MODULE=on
ENV GOTOOLCHAIN=local
ARG MD2MAN_VERSION=v2.0.1
RUN go install github.com/cpuguy83/go-md2man/v2@${MD2MAN_VERSION}

Expand Down
2 changes: 0 additions & 2 deletions dockerfiles/rpm.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ FROM ${GOLANG_IMAGE} AS golang

FROM golang AS go-md2man
ARG GOPROXY=direct
ARG GO111MODULE=on
ENV GOTOOLCHAIN=local
ARG MD2MAN_VERSION=v2.0.1
RUN go install github.com/cpuguy83/go-md2man/v2@${MD2MAN_VERSION}

Expand Down
5 changes: 1 addition & 4 deletions dockerfiles/win.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

ARG GOLANG_IMAGE=golang:latest
FROM ${GOLANG_IMAGE} AS golang
ARG GO111MODULE=auto
ENV GO111MODULE=$GO111MODULE \
GOTOOLCHAIN=local \
chocolateyUseWindowsCompression=false
ENV chocolateyUseWindowsCompression=false
# Install make and gcc
# We install an older version of MinGW to workaround issues in CGO;
# see https://github.com/golang/go/issues/51007
Expand Down
6 changes: 3 additions & 3 deletions rpm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repository.
Afterwards test if you can actually build the release with (for example):

```bash
make REF=${TAG} docker.io/library/centos:7
make REF=${TAG} quay.io/centos/centos:stream9
```

If you can actually build the package then start prepping
Expand All @@ -31,11 +31,11 @@ VERSION is already there.
Releases can then be built with:

```bash
make REF=${TAG} docker.io/library/centos:7
make REF=${TAG} quay.io/centos/centos:stream9
```

or

```bash
make REF=${TAG} BUILD_IMAGE=docker.io/library/centos:7
make REF=${TAG} BUILD_IMAGE=quay.io/centos/centos:stream9
```
38 changes: 10 additions & 28 deletions rpm/containerd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Source3: runc
%if %{undefined suse_version}
# amazonlinux2 doesn't have container-selinux either
%if "%{?dist}" != ".amzn2"
Requires: container-selinux >= 2:2.74
Requires: container-selinux
%endif
Requires: libseccomp
%else
Expand All @@ -70,21 +70,6 @@ BuildRequires: gcc
BuildRequires: systemd
BuildRequires: libseccomp-devel

# containerd 1.7.x now use Linux kernel headers for btrfs, so we only
# need this dependency when building older (1.5.x, 1.6.x) releases.
# TODO(thaJeztah): remove btrfs build-dependencies once containerd 1.6 reaches EOL.
%if "%{major_minor}" == "1.6" || "%{major_minor}" == "1.5"
%if %{undefined rhel} || 0%{?rhel} < 8
%if %{defined suse_version}
# SUSE flavors
BuildRequires: libbtrfs-devel
%else
# Fedora / others, and CentOS/RHEL < 8
BuildRequires: btrfs-progs-devel
%endif
%endif
%endif

%{?systemd_requires}

%description
Expand Down Expand Up @@ -113,29 +98,26 @@ cd %{_topdir}/BUILD/

%build
cd %{_topdir}/BUILD
GO111MODULE=auto make man
make man

BUILDTAGS=""
%if %{defined rhel} && 0%{?rhel} >= 8
# btrfs support was removed in CentOS/RHEL 8
BUILDTAGS="${BUILDTAGS} no_btrfs"
%else
# TODO(thaJeztah): remove this block once 1.5.x and 1.6.x reach EOL.
%if %{defined rhel} && 0%{?rhel} >= 7 && "%{major_minor}" != "1.6" && "%{major_minor}" != "1.5"
# containerd 1.7.x now use linux kernel headers for btrfs, which is not
# provided by CentOS/RHEL 7, so don't build with btrfs for 1.7+.

# TODO(thaJeztah): can we remove the version compare, or would that exclude other RHEL derivatives (Fedora, etc)?
%if %{defined rhel} && 0%{?rhel} >= 7
# btrfs support was removed in CentOS/RHEL 8, and containerd 1.7+ uses
# linux kernel headers for btrfs, which are not provided by CentOS/RHEL 7
# so build without btrfs support for any CentOS/RHEL version.
BUILDTAGS="${BUILDTAGS} no_btrfs"
%endif
%endif

GO111MODULE=auto make -C /go/src/%{import_path} VERSION=%{getenv:VERSION} REVISION=%{getenv:REF} PACKAGE=%{getenv:PACKAGE} BUILDTAGS="${BUILDTAGS}"
make -C /go/src/%{import_path} VERSION=%{getenv:VERSION} REVISION=%{getenv:REF} PACKAGE=%{getenv:PACKAGE} BUILDTAGS="${BUILDTAGS}"

# Remove containerd-stress, as we're not shipping it as part of the packages
rm -f bin/containerd-stress
bin/containerd --version
bin/ctr --version

GO111MODULE=auto make -C /go/src/github.com/opencontainers/runc BINDIR=%{_topdir}/BUILD/bin runc install
make -C /go/src/github.com/opencontainers/runc BINDIR=%{_topdir}/BUILD/bin runc install


%install
Expand Down