Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
223 commits
Select commit Hold shift + click to select a range
8924669
Add initial rpm building materials
seemethere Apr 23, 2018
ce2462f
Add debian package building for ubuntu xenial
seemethere Apr 24, 2018
5973981
Remove protobuf as a build requirement
seemethere Apr 25, 2018
acd2e1a
Merge pull request #1 from seemethere/xenial
andrewhsu Apr 27, 2018
dee48fd
Package containered on centos
Apr 27, 2018
e28b235
get containerd 1.1.0 rpm building working
andrewhsu May 1, 2018
20bf11b
Added a clean target for rpm based builds. Removed unecessary librari…
May 1, 2018
743e37f
Fix sha256 check
May 1, 2018
e379342
Merge pull request #2 from jose-bigio/build
andrewhsu May 1, 2018
1c1e7a6
added man pages for centos
May 4, 2018
0b69f0c
Merge pull request #7 from jose-bigio/rpm_man_pages
seemethere May 7, 2018
bee7cbb
Make package building distro agnostic
seemethere Jun 22, 2018
7c9e7aa
Allow for nightly package building
seemethere Jun 25, 2018
7a8a61d
Update to put the config in the correct place
seemethere Jul 5, 2018
d2d05aa
Do correct version for test versions
seemethere Jul 6, 2018
4af1080
Add some documentation
seemethere Jul 6, 2018
e7d95ff
Remove some unsused comments / declarations
seemethere Jul 9, 2018
2d4f464
Merge pull request #12 from seemethere/refactor
andrewhsu Jul 9, 2018
8bfa406
Add a Jenkinsfile to build containerd packages
corbin-coleman Jun 8, 2018
12621cb
Remove verification scripts
corbin-coleman Jul 9, 2018
40c7c55
Merge pull request #9 from corbin-coleman/add-jenkinsfile
seemethere Jul 11, 2018
4979f7e
Switch to using containerd build rigging
seemethere Jul 11, 2018
92bee30
Merge pull request #15 from seemethere/use_make
seemethere Jul 12, 2018
48f26bc
Make version report correctly on binaries
seemethere Jul 20, 2018
1e6ab12
Merge pull request #21 from seemethere/fix_version
seemethere Jul 20, 2018
222adea
move all rpm build deps into spec file
andrewhsu Jul 20, 2018
aadd933
move go-md2man to an rpm build dep
andrewhsu Jul 20, 2018
8ca5bfd
Merge pull request #24 from andrewhsu/move-deps
seemethere Jul 20, 2018
9c5f3fe
Merge pull request #25 from andrewhsu/dep-man
seemethere Jul 23, 2018
60aad67
Change DEB package name to containerd.io
seemethere Jul 16, 2018
ce2cd12
Change RPM package name to containerd.io
seemethere Jul 16, 2018
cc0031a
Change INSTALL_DIR to correct one
seemethere Jul 16, 2018
49da6df
Move provides/conflicts/replaces to correct section
seemethere Jul 16, 2018
eced16c
Merge pull request #18 from seemethere/change
seemethere Jul 27, 2018
5dda812
Add installer for runc
seemethere Aug 7, 2018
fb582cd
Merge pull request #28 from seemethere/runc
seemethere Aug 9, 2018
cc5c78c
Change location of runc.tar
seemethere Aug 15, 2018
41d12eb
Merge pull request #36 from seemethere/change_locale
seemethere Aug 15, 2018
624c841
Bump to v1.2.0-beta.0
seemethere Aug 16, 2018
1be55b8
Merge pull request #37 from seemethere/bump
seemethere Aug 16, 2018
f128203
Add stuff to build sles
seemethere Aug 17, 2018
c6a78c3
Merge pull request #38 from seemethere/sles
Aug 17, 2018
d92d5f9
bump ver 1.2.0 beta.2
andrewhsu Aug 28, 2018
661b311
Merge pull request #44 from andrewhsu/b2
andrewhsu Aug 28, 2018
116da74
Hardcode libexec paths and var lib paths
seemethere Sep 5, 2018
82b33b9
Bump RPM version to 1.2.0-1.2.beta.2-2
seemethere Sep 5, 2018
445d8b8
Update rpm version to include actual rpm release
seemethere Sep 5, 2018
184d64d
Remove runc image, removes offline installer
seemethere Sep 7, 2018
408d8f8
Add in runc as something we build and package
seemethere Sep 7, 2018
c0f01a4
Merge pull request #50 from seemethere/runc_again
seemethere Sep 10, 2018
950d59d
Increment containerd version for deb, add changelog
seemethere Sep 14, 2018
ea05eae
Merge pull request #51 from seemethere/deb
seemethere Sep 14, 2018
7a31603
bump to 1.2.0-rc.0
seemethere Sep 25, 2018
f851a91
Compile runc with 'seccomp apparmor selinux'
seemethere Sep 25, 2018
abb7116
Merge pull request #53 from seemethere/runc_compile_fix
andrewhsu Sep 25, 2018
5f1b356
Merge pull request #52 from seemethere/s
seemethere Sep 25, 2018
5329dd4
Add 1.2.0-rc.1 release
seemethere Oct 9, 2018
ec4af30
Merge pull request #54 from seemethere/120_rc1
dave-tucker Oct 10, 2018
5ca6dab
Add a changelog note about the containerd changes
seemethere Oct 16, 2018
69d7fb1
Merge pull request #56 from seemethere/changelog_update
seemethere Oct 16, 2018
3839e7d
containerd 1.2.0-rc.2 release
seemethere Oct 16, 2018
ef4625f
Merge pull request #57 from seemethere/u
seemethere Oct 16, 2018
8419739
Bump changelogs for 1.2.0 release
seemethere Nov 5, 2018
d13eb8f
Merge pull request #58 from seemethere/120
seemethere Nov 5, 2018
9ec7832
Mark package as "providing", "conflicting" and "obsoletes" runc
thaJeztah Nov 12, 2018
5e1bd7c
Release contaienrd 1.2.1-rc.0
thaJeztah Nov 21, 2018
02cceba
Merge pull request #64 from thaJeztah/bump_containerd_v1.2.1-rc.0
andrewhsu Nov 27, 2018
8834b3b
Do not enable kmem on RHEL7 kernels
thaJeztah Nov 29, 2018
69727d3
Merge pull request #66 from thaJeztah/nokmem_on_rhel
seemethere Nov 30, 2018
3feaabe
Remove go-md2man as a BuildRequires, prefer go get
seemethere Dec 6, 2018
a15a66a
Merge pull request #68 from docker/remove_gomd2man
seemethere Dec 6, 2018
a955c6e
bump ver for containerd 1.2.1 release
andrewhsu Dec 6, 2018
dcd74d0
update runc to 96ec217
andrewhsu Dec 6, 2018
790c80b
Merge pull request #67 from andrewhsu/121
seemethere Dec 6, 2018
0199f94
bump ver for containerd 1.2.2 rel
andrewhsu Jan 8, 2019
02e72eb
Bump to package version 1.2.2-2
seemethere Jan 18, 2019
ab0e225
Merge pull request #77 from seemethere/bump
seemethere Jan 18, 2019
01930df
Bump containerd.io version to 1.2.2-3
seemethere Jan 31, 2019
1a178e7
Merge pull request #79 from seemethere/new_runc
andrewhsu Feb 4, 2019
1fbd3cb
Release containerd 1.2.4
thaJeztah Feb 15, 2019
16f6111
Merge pull request #81 from thaJeztah/containerd_1.2.4
andrewhsu Feb 25, 2019
b45f6cf
RHEL 8 Support
Mar 3, 2019
b59c29c
Merge pull request #83 from docker/rhel8
seemethere Mar 12, 2019
e069209
Release containerd 1.2.5
thaJeztah Mar 14, 2019
68ae78e
Merge pull request #86 from thaJeztah/containerd_1.2.5
andrewhsu Mar 15, 2019
c2a1226
Release containerd 1.2.6
thaJeztah Apr 9, 2019
b312f4f
Set packagename to containerd.io in version, and make it configurable
thaJeztah Mar 14, 2019
0ce68e4
Merge pull request #84 from thaJeztah/fix_package_name
seemethere Apr 9, 2019
9fb701a
Release containerd 1.2.6-2
thaJeztah Apr 26, 2019
a1b51fc
Merge pull request #93 from thaJeztah/release_containerd_1.2.6-2
seemethere May 3, 2019
4c09fba
rpm/containerd.spec: move runc to /usr/bin
kolyshkin Jun 11, 2019
7a533d9
rpm/containerd.spec: add req for container-selinux
kolyshkin Jun 12, 2019
282a4c2
rpm/containerd.spec: workarounds for suse and amazon
kolyshkin Jun 11, 2019
207a2b8
rpm/containerd.spec: add container-selinux req (#95)
seemethere Jun 12, 2019
c0c1a7f
debian: move runc from sbin to bin
seemethere Jun 12, 2019
fad8b7d
[TAR-852] debian: move runc from sbin to bin (#97)
seemethere Jun 12, 2019
2b91d10
Refactor to be image based, see description
seemethere Jan 8, 2019
1b17cc1
rpm/containerd.spec: Fix changelog date being one month off
thaJeztah Jul 10, 2019
7d92067
Merge pull request #99 from thaJeztah/fix_changelog_date
zelahi Jul 10, 2019
87e3774
Merge pull request #75 from seemethere/refactor
zelahi Jul 10, 2019
177fb32
rpm: Do not provides runc on rhel 8
seemethere Aug 13, 2019
b4fb870
Merge pull request #102 from seemethere/no_provides_runc_rhel_8
seemethere Aug 13, 2019
9c2a22a
Bump golang 1.11.13 (CVE-2019-9512, CVE-2019-9514)
thaJeztah May 27, 2019
399ff2b
Merge pull request #103 from thaJeztah/bump_golang_1.11.13
justincormack Aug 15, 2019
5012bfc
Release containerd 1.2.8
thaJeztah Jun 14, 2019
d84b587
Merge pull request #98 from thaJeztah/containerd_1.2.7
seemethere Sep 5, 2019
c88095a
bump changelogs for containerd 1.2.9
seemethere Sep 6, 2019
52ae6dd
Merge pull request #106 from seemethere/bump_1_2_9
seemethere Sep 6, 2019
4920a43
bump version to 1.2.10-1
seemethere Sep 26, 2019
4b7dd16
bump to golang 1.12.10
seemethere Sep 30, 2019
d8cd570
[TAR-1202] bump version to 1.2.10-1 (#110)
seemethere Sep 30, 2019
f59500a
bump to containerd 1.2.10-2
seemethere Oct 7, 2019
2d39e41
bump to containerd 1.2.10-2 (#111)
seemethere Oct 8, 2019
1db70e9
deb pkgs: restart after upgrade
andrewhsu Oct 17, 2019
70bd402
Merge pull request #113 from andrewhsu/restart
seemethere Oct 17, 2019
ae3baaf
deb: Bump to 1.2.10-3
seemethere Oct 17, 2019
690591c
Merge pull request #114 from seemethere/bump_1_2_10_3
seemethere Oct 17, 2019
512a6ba
deb: Replace all instances of try-restart with restart
seemethere Oct 17, 2019
38ac468
Merge pull request #115 from seemethere/no_try_just_do
seemethere Oct 17, 2019
c62d498
update to 1.12.11
ehazlett Jan 9, 2020
00446c4
Merge pull request #125 from ehazlett/update-1.12.11
ehazlett Jan 14, 2020
a173c64
update golang to 1.12.15
thaJeztah Jan 22, 2020
558b548
Merge pull request #129 from thaJeztah/bump_golang_1.12.15
ehazlett Jan 28, 2020
46bfabb
Update packaging for containerd 1.2.12
dmcgowan Feb 4, 2020
6b1fb3b
Merge pull request #133 from dmcgowan/update-1.2.12
dmcgowan Feb 5, 2020
7a96ecb
release 1.2.13-1
thaJeztah Feb 17, 2020
4503394
Add Apache License to open source the repository
glours Feb 17, 2020
f49254d
Merge pull request #136 from glours/add_apache_license
thaJeztah Feb 21, 2020
f40fc6b
Merge pull request #135 from thaJeztah/release_1.2.13
tiborvass Feb 28, 2020
0f382c3
deb: fix formatting and missing dates in changelog
thaJeztah Mar 23, 2020
23737a6
Merge pull request #143 from thaJeztah/fix_changelog_dates
silvin-lubecki Mar 23, 2020
cd85ed7
Fix date in changelog
thaJeztah Mar 23, 2020
873da2c
Merge pull request #145 from thaJeztah/fix_more_changelog_dates
thaJeztah Mar 23, 2020
fd34302
rpm: add support for building on CentOS 8
thaJeztah Mar 23, 2020
3afd572
Merge pull request #148 from thaJeztah/build_centos8
silvin-lubecki Mar 24, 2020
7a521a8
deb: add missing format version
thaJeztah Mar 24, 2020
0f07931
Merge pull request #150 from thaJeztah/deb_missing_format_version
silvin-lubecki Mar 25, 2020
eeaaaf6
rpm: add libseccomp to "requires"
thaJeztah Mar 26, 2020
f7b3b02
Merge pull request #157 from thaJeztah/fix_dependency
silvin-lubecki Mar 30, 2020
8d9bbd5
build all binaries instead of individual targets
thaJeztah Mar 23, 2020
743aefd
deb: remove "INSTALL_DIR" variable
thaJeztah Mar 30, 2020
c90b7bc
Merge pull request #146 from thaJeztah/build_all_binaries
silvin-lubecki Apr 2, 2020
6293f67
deb: include man pages, and fix man pages in rpms
thaJeztah Apr 2, 2020
0613815
Merge pull request #165 from thaJeztah/add_deb_manpages
glours Apr 7, 2020
06cd35b
Dockerfiles: Use buildkit mounts to prevent copying things
thaJeztah Mar 26, 2020
45c1105
Update readme's
thaJeztah Mar 26, 2020
9e0c47b
Merge pull request #154 from thaJeztah/build_not_run
silvin-lubecki Apr 20, 2020
eaea00e
Prepare 1.2.13-2 release
thaJeztah May 1, 2020
e883c6c
Merge pull request #179 from thaJeztah/release_1.12.13-2
tiborvass May 2, 2020
06e2cc2
rpm: containerd 1.2 compatible BUILDTAGS variable
May 2, 2020
ef8633b
Merge pull request #180 from tiborvass/buildtags-containerd-12
thaJeztah May 2, 2020
394c6a8
release 1.3.7-1
thaJeztah Sep 9, 2020
0d3aebf
Merge pull request #198 from thaJeztah/containerd_1.3.7
tiborvass Sep 9, 2020
b88d5cb
release 1.4.1-1
Oct 6, 2020
f0245fb
release 1.4.2
thaJeztah Nov 26, 2020
5c28b0c
release 1.4.3 (CVE-2020-15257)
thaJeztah Dec 2, 2020
bca0863
Merge pull request #204 from thaJeztah/release_containerd_1.4.2
tiborvass Dec 2, 2020
6f4c764
remove default "containerd.toml" config file
thaJeztah Jan 21, 2021
e52b0ef
deb: remove dh-systemd dependency as it's deprecated
thaJeztah Jan 12, 2021
8cd7d10
Add changelog for containerd v1.4.3-2
Mar 3, 2021
2569d3f
Merge pull request #221 from tiborvass/update_runc
tiborvass Mar 3, 2021
7297473
Add changelog for containerd v1.4.4-1
fuweid Mar 8, 2021
1f929f4
Disable go modules (GO111MODULE=off) to force using vendor directory …
thaJeztah Mar 8, 2021
1e34ff6
Merge pull request #226 from thaJeztah/force_vendor
tiborvass Mar 8, 2021
001c4db
Merge pull request #223 from fuweid/update-changelog-1.4.4
tiborvass Mar 8, 2021
aea4411
debian: update image name
fuweid Mar 9, 2021
c30d5c3
Merge pull request #228 from fuweid/update-readme
thaJeztah Mar 9, 2021
a2f85af
Merge pull request #215 from thaJeztah/remove_containerd_config
thaJeztah Apr 22, 2021
0cc4b79
Revert "remove default "containerd.toml" config file"
thaJeztah May 19, 2021
4121050
prepare release v1.4.5
thaJeztah May 12, 2021
3e9e050
Merge pull request #233 from thaJeztah/partial_revert_of_config_changes
fredericdalleau May 21, 2021
6188d98
Merge pull request #232 from thaJeztah/release_1.4.5
fredericdalleau May 21, 2021
82e0b1c
prepare release v1.4.6
thaJeztah May 21, 2021
f93997c
Merge pull request #234 from thaJeztah/release_1.4.6
fredericdalleau May 21, 2021
3f8d92f
deb: fix use of PREFIX and DESTDIR for changes in containerd
thaJeztah Jun 25, 2021
a302a23
Merge pull request #237 from thaJeztah/fix_main_builds
fredericdalleau Jun 26, 2021
2fea2dd
RPM : Update libseccomp dependency name for SLES/openSUSE distros
anujajakhade Jul 12, 2021
68969fe
Merge pull request #240 from linux-on-ibm-z/s390x-changes
thaJeztah Jul 14, 2021
24e3ef3
prepare release v1.4.7
thaJeztah Jul 19, 2021
e9e0164
Merge pull request #241 from thaJeztah/prepare_release_1.4.7
thaJeztah Jul 19, 2021
40f93bc
prepare release v1.4.8
thaJeztah Jul 19, 2021
7dd2e31
Merge pull request #245 from thaJeztah/prepare_release_1.4.8
thaJeztah Jul 19, 2021
9c11883
prepare release v1.4.9
thaJeztah Jul 29, 2021
d10bb73
Merge pull request #247 from thaJeztah/prepare_release_1.4.9
thaJeztah Jul 29, 2021
2079c6f
Use GO111MODULE=auto instead of "off"
thaJeztah Sep 16, 2021
e0c365d
Merge pull request #249 from thaJeztah/use_auto_modules
thaJeztah Sep 16, 2021
89cd560
prepare release v1.4.10
thaJeztah Sep 30, 2021
ebd3b77
Merge pull request #250 from thaJeztah/release_1.4.10
thaJeztah Sep 30, 2021
947de92
prepare release v1.4.11
thaJeztah Oct 4, 2021
aaae050
Merge pull request #254 from thaJeztah/prepare_release_1.4.11
thaJeztah Oct 4, 2021
7ef12fd
deb: force dpkg-build to use xz compression instead of zstd
thaJeztah Oct 19, 2021
39e4a69
Merge pull request #257 from thaJeztah/disable_zstd_compression
thaJeztah Oct 20, 2021
59101e3
prepare release v1.4.12
thaJeztah Nov 17, 2021
7a3fe37
Merge pull request #259 from thaJeztah/containerd_1.4.12
thaJeztah Nov 17, 2021
c8a9f26
prepare release v1.4.13
thaJeztah Mar 4, 2022
a300e93
update years in license headers
thaJeztah Mar 4, 2022
9e2685a
Merge pull request #268 from thaJeztah/release_1.4.13
thaJeztah Mar 4, 2022
7287c6f
prepare release v1.5.10
thaJeztah Mar 4, 2022
cfc76f2
Merge pull request #269 from thaJeztah/update_containerd_1.5.10
thaJeztah Mar 4, 2022
da4af28
prepare release v1.5.11
thaJeztah Mar 23, 2022
8857757
Merge pull request #273 from thaJeztah/prepare_release_1.5.11
thaJeztah Mar 23, 2022
8fbf7cc
changelog: add go 1.17.8 update
thaJeztah Mar 23, 2022
765a385
Merge pull request #275 from thaJeztah/prepare_release_1.5.11_addendum
thaJeztah Mar 24, 2022
1c9d72e
prepare release v1.6.2
thaJeztah Mar 27, 2022
3a8d148
prepare release v1.6.3
thaJeztah Apr 28, 2022
320ad25
Merge pull request #278 from thaJeztah/update_containerd_1.6.2
thaJeztah Apr 28, 2022
6d1d026
Also build for CentOS 9.
Romain-Geissler-1A Mar 7, 2022
f005a88
Merge pull request #283 from thaJeztah/carry_270_centos9
thaJeztah May 4, 2022
8a93622
prepare release v1.6.4
thaJeztah May 4, 2022
5d27e78
Merge pull request #282 from thaJeztah/update_containerd_1.6.4
thaJeztah May 4, 2022
696d7c2
remove deprecated containerd and runc build-tags
thaJeztah Jun 4, 2022
55c57d2
prepare release v1.6.5
thaJeztah Jun 4, 2022
85e5556
Merge pull request #284 from thaJeztah/cleanup_buildtags
thaJeztah Jun 6, 2022
3e33f29
Merge pull request #285 from thaJeztah/release_1.6.5
thaJeztah Jun 6, 2022
2794f75
prepare release v1.6.6
thaJeztah Jun 6, 2022
ec22a82
Merge pull request #286 from thaJeztah/release_1.6.6
thaJeztah Jun 6, 2022
9357d52
prepare release v1.6.7
thaJeztah Aug 4, 2022
404e0ce
Merge pull request #290 from thaJeztah/prepare_release_1.6.7
thaJeztah Aug 4, 2022
65d6876
prepare release v1.6.8
thaJeztah Aug 25, 2022
b0fe183
Merge pull request #292 from thaJeztah/prepare_release_1.6.8
thaJeztah Aug 25, 2022
317b054
Merge remote-tracking branch 'containerd-packaging-pick/master' into …
crazy-max Sep 4, 2022
4012e72
containerd package
crazy-max Sep 4, 2022
36908ae
containerd: add RUNC_REPO and RUNC_VERSION vars
crazy-max Sep 5, 2022
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
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
name:
- docker-engine
- docker-cli
- containerd
- buildx
- compose
- credential-helpers
Expand Down
2 changes: 2 additions & 0 deletions common/vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ export PKG_PACKAGER ?= Docker <support@docker.com>

export DOCKER_ENGINE_REPO ?= https://github.com/docker/docker.git
export DOCKER_CLI_REPO ?= https://github.com/docker/cli.git
export CONTAINERD_REPO ?= https://github.com/containerd/containerd.git
export BUILDX_REPO ?= https://github.com/docker/buildx.git
export COMPOSE_REPO ?= https://github.com/docker/compose.git
export CREDENTIAL_HELPERS_REPO ?= https://github.com/docker/docker-credential-helpers.git

export DOCKER_ENGINE_VERSION ?= v20.10.17
export DOCKER_CLI_VERSION ?= v20.10.17
export CONTAINERD_VERSION ?= v1.6.8
export BUILDX_VERSION ?= v0.9.1
export COMPOSE_VERSION ?= v2.10.2
export CREDENTIAL_HELPERS_VERSION ?= v0.7.0-beta.1
1 change: 1 addition & 0 deletions pkg/containerd/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin
1 change: 1 addition & 0 deletions pkg/containerd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin
340 changes: 340 additions & 0 deletions pkg/containerd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,340 @@
# syntax=docker/dockerfile:1

# Copyright 2022 Docker Packaging authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ARG XX_VERSION="1.1.2"
ARG ALPINE_VERSION="3.16"
ARG DEBIAN_FRONTEND="noninteractive"

ARG MD2MAN_VERSION="v2.0.1"
ARG RUNC_REPO="https://github.com/opencontainers/runc.git"

# go
ARG GO_IMAGE="golang"
ARG GO_VERSION="1.18.5"
ARG GO_IMAGE_VARIANT="buster"

# pkg matrix
ARG PKG_RELEASE="debian11"
ARG PKG_TYPE="deb"
ARG PKG_DISTRO="debian"
ARG PKG_SUITE="bullseye"
ARG PKG_BASE_IMAGE="debian:bullseye"

# deb specific
ARG PKG_DEB_EPOCH="5"
ARG PKG_DEB_REVISION="0"

# rpm specific
ARG PKG_RPM_RELEASE="1"

# cross compilation helper
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx

# go base image to retrieve /usr/local/go
FROM --platform=$BUILDPLATFORM ${GO_IMAGE}:${GO_VERSION}-${GO_IMAGE_VARIANT} AS go

# md2man
FROM go AS go-md2man
ARG GOPROXY="direct"
ARG GO111MODULE="on"
ARG MD2MAN_VERSION
RUN go install github.com/cpuguy83/go-md2man/v2@${MD2MAN_VERSION}

# dummy stage for unsupported platforms
FROM --platform=$BUILDPLATFORM busybox AS builder-dummy
RUN mkdir -p /out
FROM scratch AS build-dummy
COPY --from=builder-dummy /out /out

# base stage for fetching sources and create final release
FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION} AS base
RUN apk add --no-cache bash curl file git zip tar

FROM base AS src
WORKDIR /src
ARG CONTAINERD_REPO
RUN git init . && git remote add origin "${CONTAINERD_REPO}"
ARG CONTAINERD_VERSION
RUN git fetch origin "${CONTAINERD_VERSION}" +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD

FROM base AS src-tgz
RUN --mount=from=src,source=/src,target=/containerd \
mkdir /out && tar -C / -zcf /out/containerd.tgz --exclude .git containerd

FROM base AS runc-src
WORKDIR /src
ARG RUNC_REPO
ARG RUNC_VERSION
RUN git init . && git remote add origin "${RUNC_REPO}"
RUN --mount=from=src,source=/src,target=/containerd <<EOT
[ -z "$RUNC_VERSION" ] && RUNC_VERSION=$(cat /containerd/script/setup/runc-version)
git fetch origin "$RUNC_VERSION" +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
EOT

FROM base AS runc-src-tgz
RUN --mount=from=runc-src,source=/src,target=/runc \
mkdir /out && tar -C / -zcf /out/runc.tgz --exclude .git runc

# deb
FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-deb
COPY --from=xx / /
ARG DEBIAN_FRONTEND
RUN apt-get update && apt-get install -y apt-utils bash ca-certificates curl devscripts equivs git lsb-release
ENV GOPROXY="https://proxy.golang.org|direct"
ENV GOPATH="/go"
ENV PATH="$PATH:/usr/local/go/bin:$GOPATH/bin"
COPY --from=go-md2man /go/bin/go-md2man $GOPATH/bin/go-md2man
ARG PKG_RELEASE

FROM build-base-deb AS build-deb
COPY deb /root/package/debian
ARG TARGETPLATFORM
RUN mk-build-deps -t "xx-apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/package/debian/control
WORKDIR /root/package
COPY --from=src /src ./containerd
ARG CONTAINERD_VERSION
ARG PKG_NAME
ARG PKG_RELEASE
ARG PKG_DISTRO
ARG PKG_SUITE
ARG PKG_PACKAGER
ARG PKG_DEB_REVISION
ARG PKG_DEB_EPOCH
ARG SOURCE_DATE_EPOCH
RUN --mount=source=internal,target=/internal,rw \
--mount=type=bind,from=runc-src,source=/src,target=/go/src/github.com/opencontainers/runc,rw \
--mount=type=bind,from=go,source=/usr/local/go,target=/usr/local/go \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod <<EOT
set -e
mkdir -p /out
if [ "$(xx-info arch)" != "$(TARGETPLATFORM= xx-info arch)" ]; then
echo "$(xx-info arch) architecture is not supported"
exit 0
fi
mkdir -p $GOPATH/src/github.com/containerd
ln -snf /root/package/containerd $GOPATH/src/github.com/containerd/containerd
sed 's#/usr/local/bin/containerd#/usr/bin/containerd#g' $GOPATH/src/github.com/containerd/containerd/containerd.service > /internal/containerd.service
export GO_SRC_PATH=$GOPATH/src/github.com/containerd/containerd
export CONTAINERD_REVISION=$(git --git-dir ./containerd/.git rev-parse HEAD)
xx-go --wrap
set -x
chmod -x debian/compat debian/control debian/copyright debian/manpages
dpkg-buildpackage -us -uc
pkgoutput="/out/${PKG_DISTRO}/${PKG_SUITE}/$(xx-info arch)"
if [ -n "$(xx-info variant)" ]; then
pkgoutput="${pkgoutput}/$(xx-info variant)"
fi
mkdir -p "${pkgoutput}"
cp /root/${PKG_NAME}* ${pkgoutput}/
EOT

FROM build-dummy AS builder-deb-darwin
FROM build-deb AS builder-deb-linux
FROM build-dummy AS builder-deb-windows
FROM builder-deb-${TARGETOS} AS builder-deb

# rpm
FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-rpm
COPY --from=xx / /
ENV GOPROXY="https://proxy.golang.org|direct"
ENV GOPATH="/go"
ENV PATH="$PATH:/usr/local/go/bin:$GOPATH/bin"
COPY --from=go-md2man /go/bin/go-md2man $GOPATH/bin/go-md2man
ARG PKG_RELEASE
RUN <<EOT
case "$PKG_RELEASE" in
centos7)
[ -f /etc/yum.repos.d/CentOS-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo
yum install -y git rpm-build rpmlint
;;
centos8)
[ -f /etc/yum.repos.d/CentOS-Stream-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Stream-Sources.repo
[ -f /etc/yum.repos.d/CentOS-Stream-PowerTools.repo ] && sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Stream-PowerTools.repo
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
dnf install -y git rpm-build rpmlint dnf-plugins-core
;;
centos9)
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
dnf install -y git rpm-build rpmlint dnf-plugins-core
dnf config-manager --set-enabled crb
;;
oraclelinux7)
[ -f /etc/yum.repos.d/CentOS-Sources.repo ] && sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo
yum install -y git rpm-build rpmlint
yum-config-manager --enable ol7_addons --enable ol7_optional_latest
;;
oraclelinux8)
dnf install -y git rpm-build rpmlint dnf-plugins-core
dnf config-manager --enable ol8_addons
;;
oraclelinux9)
dnf install -y git rpm-build rpmlint dnf-plugins-core
dnf config-manager --enable ol9_addons
;;
fedora*)
dnf install -y git rpm-build rpmlint dnf-plugins-core
;;
esac
EOT

FROM build-base-rpm AS build-rpm
COPY rpm /root/rpmbuild/SPECS
ARG TARGETPLATFORM
RUN <<EOT
set -e
echo "%_topdir /root/rpmbuild" > /root/.rpmmacros
case "$PKG_RELEASE" in
centos7|oraclelinux7)
yum-builddep -y /root/rpmbuild/SPECS/*.spec
;;
*)
dnf builddep -y /root/rpmbuild/SPECS/*.spec
;;
esac
EOT
WORKDIR /root/rpmbuild
COPY --from=src-tgz /out/containerd.tgz ./SOURCES/
COPY --from=runc-src-tgz /out/runc.tgz ./SOURCES/
ARG CONTAINERD_VERSION
ARG PKG_RELEASE
ARG PKG_DISTRO
ARG PKG_SUITE
ARG PKG_PACKAGER
ARG PKG_RPM_RELEASE
ARG SOURCE_DATE_EPOCH
RUN --mount=source=internal,target=/internal,rw \
--mount=type=bind,from=src,source=/src,target=/usr/local/src/containerd,rw \
--mount=type=bind,from=runc-src,source=/src,target=/go/src/github.com/opencontainers/runc,rw \
--mount=type=bind,from=go,source=/usr/local/go,target=/usr/local/go \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod <<EOT
set -e
mkdir -p /out
if [ "$(xx-info arch)" != "$(TARGETPLATFORM= xx-info arch)" ]; then
echo "$(xx-info arch) architecture is not supported"
exit 0
fi
mkdir -p $GOPATH/src/github.com/containerd
ln -snf /usr/local/src/containerd $GOPATH/src/github.com/containerd/containerd
sed 's#/usr/local/bin/containerd#/usr/bin/containerd#g' /usr/local/src/containerd/containerd.service > /internal/containerd.service
cp /internal/* ./SOURCES/
rpmVersion=${CONTAINERD_VERSION#v}
rpmVersion=$(echo $rpmVersion | sed "s/-/~/")
xx-go --wrap
set -x
rpmbuild -ba \
--define "_version ${rpmVersion}" \
--define "_origversion ${CONTAINERD_VERSION#v}" \
--define "_release $PKG_RPM_RELEASE" \
--define "_commit $(git --git-dir /usr/local/src/containerd/.git rev-parse HEAD)" \
/root/rpmbuild/SPECS/*.spec
pkgoutput="/out/${PKG_DISTRO}/${PKG_SUITE}/$(xx-info arch)"
if [ -n "$(xx-info variant)" ]; then
pkgoutput="${pkgoutput}/$(xx-info variant)"
fi
mkdir -p "${pkgoutput}"
cp ./RPMS/*/*.* ./SRPMS/* ${pkgoutput}/
EOT

FROM build-dummy AS builder-rpm-darwin
FROM build-rpm AS builder-rpm-linux
FROM build-dummy AS builder-rpm-windows
FROM builder-rpm-${TARGETOS} AS builder-rpm

# static
FROM --platform=$BUILDPLATFORM ${PKG_BASE_IMAGE} AS build-base-static
COPY --from=xx / /
ARG DEBIAN_FRONTEND
RUN apt-get update && apt-get install -y --no-install-recommends clang dpkg-dev file git lld llvm make pkg-config
ENV GOPROXY="https://proxy.golang.org|direct"
ENV GOPATH="/go"
ENV PATH="$PATH:/usr/local/go/bin:$GOPATH/bin"
ENV GO111MODULE="off"
ENV CGO_ENABLED="1"
ARG TARGETPLATFORM
RUN xx-apt-get install -y binutils dpkg-dev g++ gcc libbtrfs-dev libseccomp-dev libsecret-1-dev pkg-config

FROM build-base-static AS build-static
ARG TARGETPLATFORM
ARG DOCKER_CLI_VERSION
ARG CGO_ENABLED
WORKDIR /go/src/github.com/containerd/containerd
RUN --mount=type=bind,from=src,source=/src,target=.,rw \
--mount=type=bind,from=go,source=/usr/local/go,target=/usr/local/go,rw \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod <<EOT
set -ex
xx-go --wrap
mkdir -p /out/containerd
export CC=$(xx-info)-gcc
make STATIC=1 bin/containerd
make STATIC=1 bin/containerd-shim-runc-v2
make STATIC=1 bin/ctr
xx-verify --static bin/containerd-shim-runc-v2
xx-verify --static bin/containerd
xx-verify --static bin/ctr
mv bin/* /out/containerd
EOT
WORKDIR /go/src/github.com/opencontainers/runc
# FIXME: should be built using clang but needs https://github.com/opencontainers/runc/pull/3465
RUN --mount=type=bind,from=runc-src,source=/src,target=.,rw \
--mount=type=bind,from=go,source=/usr/local/go,target=/usr/local/go,rw \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod <<EOT
set -ex
xx-go --wrap
make static
xx-verify --static runc
mv runc /out/containerd/
EOT

FROM build-base-static AS builder-static
ARG DEBIAN_FRONTEND
RUN apt-get update && apt-get install -y --no-install-recommends bash file zip tar
WORKDIR /build
ARG CONTAINERD_VERSION
ARG TARGETPLATFORM
RUN --mount=type=bind,from=src,source=/src,target=/src \
--mount=type=bind,from=runc-src,source=/src,target=/runc-src \
--mount=type=bind,from=build-static,source=/out,target=/build <<EOT
set -e
pkgoutput="/out/static/$(xx-info os)/$(xx-info arch)"
if [ -n "$(xx-info variant)" ]; then
pkgoutput="${pkgoutput}/$(xx-info variant)"
fi
mkdir -p "${pkgoutput}"
for pkgname in *; do
workdir=$(mktemp -d -t docker-packaging.XXXXXXXXXX)
mkdir -p "$workdir/${pkgname}"
(
set -x
cp ${pkgname}/* /src/LICENSE /src/README.md "$workdir/${pkgname}/"
cp /runc-src/LICENSE "$workdir/${pkgname}/runc.LICENSE"
cp /runc-src/README.md "$workdir/${pkgname}/runc.README.md"
)
if [ "$(xx-info os)" = "windows" ]; then
(set -x ; cd "$workdir" ; zip -r "${pkgoutput}/${pkgname}_${CONTAINERD_VERSION#v}.zip" ${pkgname})
else
(set -x ; tar -czf "${pkgoutput}/${pkgname}_${CONTAINERD_VERSION#v}.tgz" -C "$workdir" ${pkgname})
fi
done
EOT

FROM builder-${PKG_TYPE} AS build-pkg

FROM scratch AS pkg
COPY --from=build-pkg /out /
Loading