Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 519d71a

Browse files
authored
Merge pull request #433 from glours/backport-master-to-19.03
Backport master latest commits to 19.03 Upstream-commit: 4814b6e5ef2bf510bd436158e0811db42a24e057 Component: packaging
2 parents 0050cf5 + 4668185 commit 519d71a

27 files changed

Lines changed: 212 additions & 515 deletions

File tree

components/packaging/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
build
22
debbuild
33
rpmbuild
4-
tmp
5-
artifacts
64
sources
75
*.tar
8-
image-linux*

components/packaging/.unir.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# The list of people who can trigger an auto-merge with approvals
22
whitelist:
3-
- seemethere
4-
- andrewhsu
5-
- jose-bigio
6-
- corbin-coleman
3+
- andrewhsu
4+
- silvin-lubecki
5+
- StefanScherer
6+
- thaJeztah
7+
- zelahi
78

89
# At least 2 approvals are needed for auto-merging
910
approvals_needed: 2

components/packaging/Jenkinsfile

Lines changed: 30 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,56 @@
11
#!groovy
22

3-
4-
def genBranch(String arch, String branch) {
5-
return [
6-
"${arch}": { ->
7-
stage("Build engine image on ${arch}") {
8-
wrappedNode(label: "linux && ${arch}", cleanWorkspace: true) {
9-
try {
10-
checkout scm
11-
sh("git clone https://github.com/docker/engine.git")
12-
sh("git -C engine checkout $branch")
13-
sh('make ENGINE_DIR=$(pwd)/engine image')
14-
} finally {
15-
sh('make ENGINE_DIR=$(pwd)/engine clean-image clean-engine')
16-
}
17-
}
18-
}
19-
}]
20-
}
21-
223
def branch = env.CHANGE_TARGET ?: env.BRANCH_NAME
234

245
test_steps = [
256
'deb': { ->
267
stage('Ubuntu Xenial Debian Package') {
278
wrappedNode(label: 'ubuntu && x86_64', cleanWorkspace: true) {
28-
checkout scm
29-
sh('git clone https://github.com/docker/cli.git')
30-
sh("git -C cli checkout $branch")
31-
sh('git clone https://github.com/docker/engine.git')
32-
sh("git -C engine checkout $branch")
33-
sh('make VERSION=0.0.1-dev DOCKER_BUILD_PKGS=ubuntu-xenial ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli deb')
9+
try {
10+
checkout scm
11+
sh('git clone https://github.com/docker/cli.git')
12+
sh("git -C cli checkout $branch")
13+
sh('git clone https://github.com/docker/engine.git')
14+
sh("git -C engine checkout $branch")
15+
sh('make -C deb VERSION=0.0.1-dev ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli ubuntu-xenial')
16+
} finally {
17+
sh('make ENGINE_DIR=$(pwd)/engine clean-engine')
18+
}
3419
}
3520
}
3621
},
3722
'rpm': { ->
3823
stage('Centos 7 RPM Package') {
3924
wrappedNode(label: 'ubuntu && x86_64', cleanWorkspace: true) {
40-
checkout scm
41-
sh('git clone https://github.com/docker/cli.git')
42-
sh("git -C cli checkout $branch")
43-
sh('git clone https://github.com/docker/engine.git')
44-
sh("git -C engine checkout $branch")
45-
sh('make VERSION=0.0.1-dev DOCKER_BUILD_PKGS=centos-7 ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli rpm')
25+
try {
26+
checkout scm
27+
sh('git clone https://github.com/docker/cli.git')
28+
sh("git -C cli checkout $branch")
29+
sh('git clone https://github.com/docker/engine.git')
30+
sh("git -C engine checkout $branch")
31+
sh('make -C rpm VERSION=0.0.1-dev ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli centos-7')
32+
} finally {
33+
sh('make ENGINE_DIR=$(pwd)/engine clean-engine')
34+
}
4635
}
4736
}
4837
},
4938
'static': { ->
5039
stage('Static Linux Binaries') {
5140
wrappedNode(label: 'ubuntu && x86_64', cleanWorkspace: true) {
52-
checkout scm
53-
sh('git clone https://github.com/docker/cli.git')
54-
sh("git -C cli checkout $branch")
55-
sh('git clone https://github.com/docker/engine.git')
56-
sh("git -C engine checkout $branch")
57-
sh('make VERSION=0.0.1-dev DOCKER_BUILD_PKGS=static-linux ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli static')
41+
try {
42+
checkout scm
43+
sh('git clone https://github.com/docker/cli.git')
44+
sh("git -C cli checkout $branch")
45+
sh('git clone https://github.com/docker/engine.git')
46+
sh("git -C engine checkout $branch")
47+
sh('make VERSION=0.0.1-dev DOCKER_BUILD_PKGS=static-linux ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli static')
48+
} finally {
49+
sh('make ENGINE_DIR=$(pwd)/engine clean-engine')
50+
}
5851
}
5952
}
6053
},
6154
]
6255

63-
arches = [
64-
"x86_64",
65-
"aarch64",
66-
"armhf"
67-
]
68-
69-
arches.each {
70-
test_steps << genBranch(it, branch)
71-
}
72-
7356
parallel(test_steps)

components/packaging/Makefile

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,51 +13,26 @@ help: ## show make targets
1313

1414
.PHONY: clean-engine
1515
clean-engine:
16+
[ ! -d $(ENGINE_DIR) ] || docker run --rm -v $(ENGINE_DIR):/v -w /v alpine chown -R $(shell id -u):$(shell id -g) /v
1617
rm -rf $(ENGINE_DIR)
1718

18-
.PHONY: clean-image
19-
clean-image:
20-
$(MAKE) ENGINE_DIR=$(ENGINE_DIR) -C image clean
21-
22-
2319
.PHONY: clean
24-
clean: clean-image ## remove build artifacts
20+
clean: ## remove build artifacts
2521
$(MAKE) -C rpm clean
2622
$(MAKE) -C deb clean
2723
$(MAKE) -C static clean
2824

2925
.PHONY: rpm
30-
rpm: DOCKER_BUILD_PKGS:=$(shell find rpm -type d | grep ".*-.*" | sed 's/^rpm\///')
3126
rpm: ## build rpm packages
32-
for p in $(DOCKER_BUILD_PKGS); do \
33-
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) $${p}; \
34-
done
27+
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) rpm
3528

3629
.PHONY: deb
37-
deb: DOCKER_BUILD_PKGS:=$(shell find deb -type d | grep ".*-.*" | sed 's/^deb\///')
3830
deb: ## build deb packages
39-
for p in $(DOCKER_BUILD_PKGS); do \
40-
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) $${p}; \
41-
done
31+
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) deb
4232

4333
.PHONY: static
4434
static: DOCKER_BUILD_PKGS:=static-linux cross-mac cross-win cross-arm
4535
static: ## build static-compiled packages
4636
for p in $(DOCKER_BUILD_PKGS); do \
4737
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) $${p}; \
4838
done
49-
50-
# TODO - figure out multi-arch
51-
.PHONY: image
52-
image: DOCKER_BUILD_PKGS:=image-linux
53-
image: ## build static-compiled packages
54-
for p in $(DOCKER_BUILD_PKGS); do \
55-
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) $${p}; \
56-
done
57-
58-
engine-$(ARCH).tar:
59-
$(MAKE) -C image $@
60-
61-
.PHONY: release
62-
release:
63-
$(MAKE) -C image $@

components/packaging/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ This repository is solely maintained by Docker, Inc.
77

88
The scripts will build for this list of packages types:
99

10+
* DEB packages for Ubuntu 19.04 Disco
11+
* DEB packages for Ubuntu 18.10 Cosmic
1012
* DEB packages for Ubuntu 18.04 Bionic
1113
* DEB packages for Ubuntu 16.04 Xenial
1214
* DEB packages for Debian 10 Buster
1315
* DEB packages for Debian 9 Stretch
16+
* RPM packages for Fedora 31
17+
* RPM packages for Fedora 30
18+
* RPM packages for Fedora 29
1419
* RPM packages for Fedora 28
15-
* RPM packages for Fedora 27
1620
* RPM packages for CentOS 7
1721
* TGZ and ZIP files with static binaries

components/packaging/deb/Makefile

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ ifdef BUILD_IMAGE
1616
endif
1717

1818
COMMON_FILES=common
19-
BUILD?=docker build \
19+
BUILD?=DOCKER_BUILDKIT=1 \
20+
docker build \
2021
$(BUILD_IMAGE_FLAG) \
2122
--build-arg GO_IMAGE=$(GO_IMAGE) \
2223
--build-arg COMMON_FILES=$(COMMON_FILES) \
@@ -34,9 +35,14 @@ RUN=docker run --rm -i \
3435
$(RUN_FLAGS) \
3536
debbuild-$@/$(ARCH)
3637

37-
SOURCE_FILES=engine-image cli.tgz engine.tgz docker.service docker.socket distribution_based_engine.json plugin-installers.tgz
38+
SOURCE_FILES=cli.tgz engine.tgz docker.service docker.socket plugin-installers.tgz
3839
SOURCES=$(addprefix sources/, $(SOURCE_FILES))
3940

41+
DEBIAN_VERSIONS := debian-stretch debian-buster
42+
UBUNTU_VERSIONS := ubuntu-xenial ubuntu-bionic ubuntu-cosmic ubuntu-disco
43+
RASPBIAN_VERSIONS := raspbian-stretch raspbian-buster
44+
DISTROS := $(DEBIAN_VERSIONS) $(UBUNTU_VERSIONS) $(RASPBIAN_VERSIONS)
45+
4046
.PHONY: help
4147
help: ## show make targets
4248
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@@ -47,41 +53,22 @@ clean: ## remove build artifacts
4753
$(RM) -r debbuild
4854
[ ! -d sources ] || $(CHOWN) -R $(shell id -u):$(shell id -g) sources
4955
$(RM) -r sources
50-
$(RM) engine-image
51-
52-
engine-$(ARCH).tar:
53-
$(MAKE) -C ../image image-linux
54-
docker save -o $@ $$(cat ../image/image-linux)
5556

5657
.PHONY: deb
57-
deb: ubuntu debian raspbian ## build all deb packages
58+
deb: ubuntu debian ## build all deb packages except for raspbian
5859

5960
.PHONY: ubuntu
60-
ubuntu: ubuntu-bionic ubuntu-xenial ubuntu-disco ubuntu-eoan ## build all ubuntu deb packages
61+
ubuntu: $(UBUNTU_VERSIONS) ## build all ubuntu deb packages
6162

6263
.PHONY: debian
63-
debian: debian-stretch debian-buster ## build all debian deb packages
64+
debian: $(DEBIAN_VERSIONS) ## build all debian deb packages
6465

6566
.PHONY: raspbian
66-
raspbian: raspbian-stretch raspbian-buster ## build all raspbian deb packages
67-
68-
.PHONY: ubuntu-%
69-
## build ubuntu deb packages
70-
ubuntu-%: $(SOURCES)
71-
$(BUILD)
72-
$(RUN)
73-
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@
74-
75-
.PHONY: debian-%
76-
## build debian deb packages
77-
debian-%: $(SOURCES)
78-
$(BUILD)
79-
$(RUN)
80-
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@
67+
raspbian: $(RASPBIAN_VERSIONS) ## build all raspbian deb packages
8168

82-
.PHONY: raspbian-%
83-
## build raspbian deb packages
84-
raspbian-%: $(SOURCES)
69+
.PHONY: $(DISTROS)
70+
$(DISTROS): $(SOURCES)
71+
@echo "== Building packages for $@ =="
8572
$(BUILD)
8673
$(RUN)
8774
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@
@@ -110,18 +97,6 @@ sources/docker.socket: ../systemd/docker.socket
11097
mkdir -p $(@D)
11198
cp $< $@
11299

113-
# TODO: Figure out how to decouple this
114-
# TODO: These might just end up being static files that are hardcoded
115-
# TODO: FROM HERE <=====================
116-
sources/distribution_based_engine.json: sources/engine-image
117-
mkdir -p $(@D)
118-
echo '{"platform":"Docker Engine - Community","engine_image":"engine-community","containerd_min_version":"1.2.0-beta.1","runtime":"host_install"}' > $@
119-
120-
sources/engine-image:
121-
mkdir -p $(@D)
122-
echo "docker.io/dockereng/engine-community:$(STATIC_VERSION)" > $@
123-
# TODO: TO HERE <=====================
124-
125100
sources/plugin-installers.tgz: $(wildcard ../plugins/*)
126101
docker run --rm -i -w /v \
127102
-v $(PLUGINS_DIR):/plugins \

components/packaging/deb/common/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Vcs-Git: git://github.com/docker/docker.git
2828
Package: docker-ce
2929
Architecture: linux-any
3030
Depends: docker-ce-cli, containerd.io (>= 1.2.2-3), iptables, libseccomp2 (>= 2.3.0), ${shlibs:Depends}
31-
Recommends: aufs-tools,
31+
Recommends: aufs-tools [amd64],
3232
ca-certificates,
3333
cgroupfs-mount | cgroup-lite,
3434
git,

components/packaging/deb/common/rules

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ override_dh_auto_install:
4949
install -D -m 0755 $(shell readlink -e engine/bundles/dynbinary-daemon/dockerd) debian/docker-ce/usr/bin/dockerd
5050
install -D -m 0755 /usr/local/bin/docker-proxy debian/docker-ce/usr/bin/docker-proxy
5151
install -D -m 0755 /usr/local/bin/docker-init debian/docker-ce/usr/bin/docker-init
52-
install -D -m 0644 /sources/distribution_based_engine.json debian/docker-ce/var/lib/docker-engine/distribution_based_engine.json
5352

5453
override_dh_installinit:
5554
# use "docker" as our service name, not "docker-ce"

components/packaging/deb/debian-buster/Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
ARG GO_IMAGE
2-
ARG BUILD_IMAGE=debian:buster
3-
FROM ${GO_IMAGE} as golang
2+
ARG DISTRO=debian
3+
ARG SUITE=buster
4+
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
5+
6+
FROM ${GO_IMAGE} AS golang
47

58
FROM ${BUILD_IMAGE}
69

710
RUN apt-get update && apt-get install -y curl devscripts equivs git
811

9-
ARG GO_VERSION
12+
ENV GOPROXY=direct
13+
ENV GO111MODULE=off
1014
ENV GOPATH /go
1115
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
1216
ENV DOCKER_BUILDTAGS apparmor seccomp selinux
@@ -17,9 +21,10 @@ COPY ${COMMON_FILES} /root/build-deb/debian
1721
RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
1822

1923
COPY sources/ /sources
20-
21-
ENV DISTRO debian
22-
ENV SUITE buster
24+
ARG DISTRO
25+
ARG SUITE
26+
ENV DISTRO=${DISTRO}
27+
ENV SUITE=${SUITE}
2328

2429
COPY --from=golang /usr/local/go /usr/local/go
2530

components/packaging/deb/debian-stretch/Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
ARG GO_IMAGE
2-
ARG BUILD_IMAGE=debian:stretch
3-
FROM ${GO_IMAGE} as golang
2+
ARG DISTRO=debian
3+
ARG SUITE=stretch
4+
ARG BUILD_IMAGE=${DISTRO}:${SUITE}
5+
6+
FROM ${GO_IMAGE} AS golang
47

58
FROM ${BUILD_IMAGE}
69

710
RUN apt-get update && apt-get install -y curl devscripts equivs git
811

9-
ARG GO_VERSION
12+
ENV GOPROXY=direct
13+
ENV GO111MODULE=off
1014
ENV GOPATH /go
1115
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
1216
ENV DOCKER_BUILDTAGS apparmor seccomp selinux
@@ -17,9 +21,10 @@ COPY ${COMMON_FILES} /root/build-deb/debian
1721
RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control
1822

1923
COPY sources/ /sources
20-
21-
ENV DISTRO debian
22-
ENV SUITE stretch
24+
ARG DISTRO
25+
ARG SUITE
26+
ENV DISTRO=${DISTRO}
27+
ENV SUITE=${SUITE}
2328

2429
COPY --from=golang /usr/local/go /usr/local/go
2530

0 commit comments

Comments
 (0)