Skip to content

Commit 06ff8d1

Browse files
authored
Merge pull request #223 from seemethere/f
Use image artifacts as daemon and dependencies
2 parents 10ec63c + 944fa71 commit 06ff8d1

File tree

22 files changed

+207
-144
lines changed

22 files changed

+207
-144
lines changed

deb/Makefile

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ BUILD?=docker build \
2121
$(BUILD_IMAGE_FLAG) \
2222
--build-arg GO_IMAGE=$(GO_IMAGE) \
2323
--build-arg COMMON_FILES=$(COMMON_FILES) \
24-
--build-arg CONTAINERD_SHIM_PROCESS_IMAGE=$(CONTAINERD_SHIM_PROCESS_IMAGE) \
24+
--build-arg ENGINE_IMAGE="$(shell cat sources/engine-image)" \
2525
-t debbuild-$@/$(ARCH) \
2626
-f $(CURDIR)/$@/Dockerfile .
2727
RUN=docker run --rm -i \
@@ -32,12 +32,8 @@ RUN=docker run --rm -i \
3232
-v $(CURDIR)/debbuild/$@:/build \
3333
debbuild-$@/$(ARCH)
3434

35-
SOURCE_FILES=containerd-proxy.tgz cli.tgz docker.service dockerd.json engine.tar
35+
SOURCE_FILES=engine-image cli.tgz docker.service distribution_based_engine.json
3636
SOURCES=$(addprefix sources/, $(SOURCE_FILES))
37-
ENGINE_IMAGE=docker/engine-community
38-
ENGINE_SCOPE=ce
39-
40-
IMAGE_TAG=nightly
4137

4238
.PHONY: help
4339
help: ## show make targets
@@ -49,9 +45,7 @@ clean: ## remove build artifacts
4945
$(RM) -r debbuild
5046
[ ! -d sources ] || $(CHOWN) -R $(shell id -u):$(shell id -g) sources
5147
$(RM) -r sources
52-
[ ! -d artifacts ] || $(CHOWN) -R $(shell id -u):$(shell id -g) artifacts
53-
$(RM) -r artifacts
54-
-docker rm docker2oci
48+
$(RM) engine-image
5549

5650
engine-$(ARCH).tar:
5751
$(MAKE) -C ../image image-linux
@@ -133,29 +127,16 @@ sources/cli.tgz:
133127
alpine \
134128
tar -C / -c -z -f /v/cli.tgz --exclude .git cli
135129

136-
sources/containerd-proxy.tgz:
137-
mkdir -p tmp/
138-
curl -fL -o tmp/containerd-proxy.tgz "https://github.com/crosbymichael/containerd-proxy/archive/$(CONTAINERD_PROXY_COMMIT).tar.gz"
139-
tar xzf tmp/containerd-proxy.tgz -C tmp/
140-
mv tmp/containerd-proxy-$(CONTAINERD_PROXY_COMMIT) tmp/containerd-proxy
141-
mkdir -p $(@D)
142-
$(CHOWN) -R $(shell id -u):$(shell id -g) $$(dirname $(@D))
143-
tar -zcf $@ -C tmp/ containerd-proxy
144-
rm -rf tmp/
145-
146130
sources/docker.service: ../systemd/docker.service
147131
mkdir -p $(@D)
148132
cp $< $@
149133

150-
sources/dockerd.json: ../common/dockerd.json
134+
sources/distribution_based_engine.json: sources/engine-image
151135
mkdir -p $(@D)
152-
sed \
153-
-e 's!$${ENGINE_IMAGE}!$(ENGINE_IMAGE)!' \
154-
-e 's!$${ENGINE_SCOPE}!$(ENGINE_SCOPE)!' \
155-
-e 's/$${IMAGE_TAG}/$(IMAGE_TAG)/' \
156-
$< > $@
157-
158-
# offline bundle
159-
sources/engine.tar:
160-
$(MAKE) -C ../image ENGINE_IMAGE=$(ENGINE_IMAGE) ENGINE_SCOPE=$(ENGINE_SCOPE) engine-$(ARCH).tar
161-
mv ../image/engine-$(ARCH).tar $@
136+
docker inspect "$(shell cat $<)" \
137+
--format '{{index .Config.Labels "com.docker.distribution_based_engine" }}' > $@
138+
139+
sources/engine-image:
140+
mkdir -p $(@D)
141+
$(MAKE) -C ../image image-linux
142+
cp ../image/image-linux $@

deb/common/control

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Build-Depends: bash-completion,
66
dh-apparmor,
77
dh-systemd,
88
libltdl-dev,
9+
libseccomp2,
910
make,
1011
gcc
1112
Standards-Version: 3.9.6

deb/common/docker-ce.postinst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
#!/bin/sh
22
set -e
33

4+
update_dockerd() {
5+
dbefile=/var/lib/docker/distribution_based_engine.json
6+
URL=https://docs.docker.com/releasenote
7+
if [ -f "${dbefile}" ] && sed -e 's/.*"platform"[ \t]*:[ \t]*"\([^"]*\)".*/\1/g' "${dbefile}"| grep -v -i community > /dev/null; then
8+
echo
9+
echo
10+
echo
11+
echo "Warning: Your engine has been activated to Docker Engine - Enterprise but you are still using Community packages"
12+
echo "You can use the 'docker engine update' command to update your system, or switch to using the Enterprise packages."
13+
echo "See $URL for more details."
14+
echo
15+
echo
16+
echo
17+
else
18+
rm -f /usr/bin/dockerd
19+
update-alternatives --install /usr/bin/dockerd dockerd /usr/bin/dockerd-ce 1 --slave \
20+
${dbefile} distribution_based_engine.json /var/lib/docker/distribution_based_engine-ce.json
21+
fi
22+
}
23+
424
case "$1" in
525
configure)
626
if [ -z "$2" ]; then
727
if ! getent group docker > /dev/null; then
828
groupadd --system docker
929
fi
1030
fi
31+
update_dockerd
32+
;;
33+
update)
34+
update_dockerd
1135
;;
1236
abort-*)
1337
# How'd we get here??

deb/common/docker-ce.prerm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
set -e
3+
4+
update-alternatives --remove dockerd /usr/bin/dockerd-ce
5+

deb/common/rules

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ override_dh_gencontrol:
1010
override_dh_auto_build:
1111
cd /go/src/github.com/docker/cli && \
1212
LDFLAGS='' DISABLE_WARN_OUTSIDE_CONTAINER=1 make VERSION=$(VERSION) GITCOMMIT=$(DOCKER_GITCOMMIT) dynbinary manpages
13-
cd /go/src/github.com/crosbymichael/containerd-proxy && \
14-
make SCOPE_LABEL="com.docker/containerd-proxy.scope" ANY_SCOPE="ee" bin/containerd-proxy
1513

1614
override_dh_strip:
1715
# Go has lots of problems with stripping, so just don't
@@ -22,20 +20,19 @@ override_dh_auto_install:
2220
install -D -m 0644 /go/src/github.com/docker/cli/contrib/completion/zsh/_docker debian/docker-ce-cli/usr/share/zsh/vendor-completions/_docker
2321
install -D -m 0755 /go/src/github.com/docker/cli/build/docker debian/docker-ce-cli/usr/bin/docker
2422
# docker-ce install
25-
install -D -m 0755 /go/src/github.com/crosbymichael/containerd-proxy/bin/containerd-proxy debian/docker-ce/usr/bin/dockerd
26-
install -D -m 0644 /containerd-shim-process-v1 debian/docker-ce/usr/sbin/containerd-shim-process-v1
27-
install -D -m 0644 /sources/engine.tar debian/docker-ce/var/lib/docker-engine/engine.tar
2823
install -D -m 0644 /sources/docker.service debian/docker-ce/lib/systemd/system/docker.service
29-
install -D -m 0644 /sources/dockerd.json debian/docker-ce/etc/containerd-proxy/dockerd.json
24+
install -D -m 0755 /source/dockerd debian/docker-ce/usr/bin/dockerd-ce
25+
install -D -m 0755 /source/docker-proxy debian/docker-ce/usr/bin/docker-proxy
26+
install -D -m 0755 /source/docker-init debian/docker-ce/usr/bin/docker-init
27+
install -D -m 0644 /sources/distribution_based_engine.json debian/docker-ce/var/lib/docker/distribution_based_engine-ce.json
3028

29+
override_dh_shlibdeps:
30+
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
3131

3232
override_dh_install:
3333
dh_install
3434
# TODO Can we do this from within our container?
3535
dh_apparmor --profile-name=docker-ce -pdocker-ce
3636

37-
override_dh_shlibdeps:
38-
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
39-
4037
%:
4138
dh $@ --with=bash-completion $(shell command -v dh_systemd_enable > /dev/null 2>&1 && echo --with=systemd)

deb/debian-buster/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ARG GO_IMAGE
2-
ARG CONTAINERD_SHIM_PROCESS_IMAGE
32
ARG BUILD_IMAGE=debian:buster
3+
ARG ENGINE_IMAGE
44
FROM ${GO_IMAGE} as golang
5-
FROM ${CONTAINERD_SHIM_PROCESS_IMAGE} as shim-process
5+
FROM ${ENGINE_IMAGE} as engine
66

77
FROM ${BUILD_IMAGE}
88

@@ -21,15 +21,16 @@ RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-reco
2121
# Copy our sources and untar them
2222
COPY sources/ /sources
2323
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/
24-
RUN mkdir -p /go/src/github.com/crosbymichael && tar -xzf /sources/containerd-proxy.tgz -C /go/src/github.com/crosbymichael
2524

2625
RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli
2726

2827
ENV DISTRO debian
2928
ENV SUITE buster
3029

3130
COPY --from=golang /usr/local/go /usr/local/go
32-
COPY --from=shim-process /bin/containerd-shim-process-v1 /containerd-shim-process-v1
31+
COPY --from=engine /bin/dockerd /source/
32+
COPY --from=engine /bin/docker-proxy /source/
33+
COPY --from=engine /bin/docker-init /source/
3334

3435
WORKDIR /root/build-deb
3536
COPY build-deb /root/build-deb/build-deb

deb/debian-jessie/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ARG GO_IMAGE
2-
ARG CONTAINERD_SHIM_PROCESS_IMAGE
2+
ARG ENGINE_IMAGE
33
ARG BUILD_IMAGE=debian:jessie
44
FROM ${GO_IMAGE} as golang
5-
FROM ${CONTAINERD_SHIM_PROCESS_IMAGE} as shim-process
5+
FROM ${ENGINE_IMAGE} as engine
66

77
FROM ${BUILD_IMAGE}
88

@@ -21,15 +21,16 @@ RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-reco
2121
# Copy our sources and untar them
2222
COPY sources/ /sources
2323
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/
24-
RUN mkdir -p /go/src/github.com/crosbymichael && tar -xzf /sources/containerd-proxy.tgz -C /go/src/github.com/crosbymichael
2524

2625
RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli
2726

2827
ENV DISTRO debian
2928
ENV SUITE jessie
3029

3130
COPY --from=golang /usr/local/go /usr/local/go
32-
COPY --from=shim-process /bin/containerd-shim-process-v1 /containerd-shim-process-v1
31+
COPY --from=engine /bin/dockerd /source/
32+
COPY --from=engine /bin/docker-proxy /source/
33+
COPY --from=engine /bin/docker-init /source/
3334

3435
WORKDIR /root/build-deb
3536
COPY build-deb /root/build-deb/build-deb

deb/debian-stretch/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ARG GO_IMAGE
2-
ARG CONTAINERD_SHIM_PROCESS_IMAGE
2+
ARG ENGINE_IMAGE
33
ARG BUILD_IMAGE=debian:stretch
44
FROM ${GO_IMAGE} as golang
5-
FROM ${CONTAINERD_SHIM_PROCESS_IMAGE} as shim-process
5+
FROM ${ENGINE_IMAGE} as engine
66

77
FROM ${BUILD_IMAGE}
88

@@ -21,15 +21,16 @@ RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-reco
2121
# Copy our sources and untar them
2222
COPY sources/ /sources
2323
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/
24-
RUN mkdir -p /go/src/github.com/crosbymichael && tar -xzf /sources/containerd-proxy.tgz -C /go/src/github.com/crosbymichael
2524

2625
RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli
2726

2827
ENV DISTRO debian
2928
ENV SUITE stretch
3029

3130
COPY --from=golang /usr/local/go /usr/local/go
32-
COPY --from=shim-process /bin/containerd-shim-process-v1 /containerd-shim-process-v1
31+
COPY --from=engine /bin/dockerd /source/
32+
COPY --from=engine /bin/docker-proxy /source/
33+
COPY --from=engine /bin/docker-init /source/
3334

3435
WORKDIR /root/build-deb
3536
COPY build-deb /root/build-deb/build-deb

deb/raspbian-jessie/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ARG GO_IMAGE
2-
ARG CONTAINERD_SHIM_PROCESS_IMAGE
2+
ARG ENGINE_IMAGE
33
ARG BUILD_IMAGE=resin/rpi-raspbian:jessie
44
FROM ${GO_IMAGE} as golang
5-
FROM ${CONTAINERD_SHIM_PROCESS_IMAGE} as shim-process
5+
FROM ${ENGINE_IMAGE} as engine
66

77
FROM ${BUILD_IMAGE}
88

@@ -21,15 +21,16 @@ RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-reco
2121
# Copy our sources and untar them
2222
COPY sources/ /sources
2323
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/
24-
RUN mkdir -p /go/src/github.com/crosbymichael && tar -xzf /sources/containerd-proxy.tgz -C /go/src/github.com/crosbymichael
2524

2625
RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli
2726

2827
ENV DISTRO raspbian
2928
ENV SUITE jessie
3029

3130
COPY --from=golang /usr/local/go /usr/local/go
32-
COPY --from=shim-process /bin/containerd-shim-process-v1 /containerd-shim-process-v1
31+
COPY --from=engine /bin/dockerd /source/
32+
COPY --from=engine /bin/docker-proxy /source/
33+
COPY --from=engine /bin/docker-init /source/
3334

3435
WORKDIR /root/build-deb
3536
COPY build-deb /root/build-deb/build-deb

deb/raspbian-stretch/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ARG GO_IMAGE
2-
ARG CONTAINERD_SHIM_PROCESS_IMAGE
2+
ARG ENGINE_IMAGE
33
ARG BUILD_IMAGE=resin/rpi-raspbian:stretch
44
FROM ${GO_IMAGE} as golang
5-
FROM ${CONTAINERD_SHIM_PROCESS_IMAGE} as shim-process
5+
FROM ${ENGINE_IMAGE} as engine
66

77
FROM ${BUILD_IMAGE}
88

@@ -21,15 +21,16 @@ RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-reco
2121
# Copy our sources and untar them
2222
COPY sources/ /sources
2323
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/
24-
RUN mkdir -p /go/src/github.com/crosbymichael && tar -xzf /sources/containerd-proxy.tgz -C /go/src/github.com/crosbymichael
2524

2625
RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli
2726

2827
ENV DISTRO raspbian
2928
ENV SUITE stretch
3029

3130
COPY --from=golang /usr/local/go /usr/local/go
32-
COPY --from=shim-process /bin/containerd-shim-process-v1 /containerd-shim-process-v1
31+
COPY --from=engine /bin/dockerd /source/
32+
COPY --from=engine /bin/docker-proxy /source/
33+
COPY --from=engine /bin/docker-init /source/
3334

3435
WORKDIR /root/build-deb
3536
COPY build-deb /root/build-deb/build-deb

0 commit comments

Comments
 (0)