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
22 changes: 16 additions & 6 deletions deb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ARCH:=$(shell uname -m)
CLI_DIR:=$(CURDIR)/../../cli
GITCOMMIT?=$(shell cd $(CLI_DIR) && git rev-parse --short HEAD)
VERSION?=0.0.0-dev
STATIC_VERSION=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION))
GO_BASE_IMAGE=golang
GO_VERSION:=1.11.5
GO_IMAGE=$(GO_BASE_IMAGE):$(GO_VERSION)
Expand All @@ -21,7 +22,6 @@ BUILD?=docker build \
$(BUILD_IMAGE_FLAG) \
--build-arg GO_IMAGE=$(GO_IMAGE) \
--build-arg COMMON_FILES=$(COMMON_FILES) \
--build-arg ENGINE_IMAGE="$(shell cat sources/engine-image)" \
-t debbuild-$@/$(ARCH) \
-f $(CURDIR)/$@/Dockerfile .
# Additional flags may be necessary at some point
Expand All @@ -35,7 +35,7 @@ RUN=docker run --rm -i \
$(RUN_FLAGS) \
debbuild-$@/$(ARCH)

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

.PHONY: help
Expand Down Expand Up @@ -94,6 +94,14 @@ raspbian-stretch: $(SOURCES)
$(RUN)
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@

sources/engine.tgz:
mkdir -p $(@D)
docker run --rm -i -w /v \
-v $(ENGINE_DIR):/engine \
-v $(CURDIR)/$(@D):/v \
alpine \
tar -C / -c -z -f /v/engine.tgz --exclude .git engine

sources/cli.tgz:
mkdir -p $(@D)
docker run --rm -i -w /v \
Expand All @@ -110,15 +118,17 @@ sources/docker.socket: ../systemd/docker.socket
mkdir -p $(@D)
cp $< $@

# TODO: Figure out how to decouple this
# TODO: These might just end up being static files that are hardcoded
# TODO: FROM HERE <=====================
sources/distribution_based_engine.json: sources/engine-image
mkdir -p $(@D)
docker inspect "$(shell cat $<)" \
--format '{{index .Config.Labels "com.docker.distribution_based_engine" }}' > $@
echo '{"platform":"Docker Engine - Community","engine_image":"engine-community","containerd_min_version":"1.2.0-beta.1","runtime":"host_install"}' > $@

sources/engine-image:
mkdir -p $(@D)
$(MAKE) -C ../image image-linux
cp ../image/image-linux $@
echo "docker.io/dockereng/engine-community:$(STATIC_VERSION)" > $@
# TODO: TO HERE <=====================

sources/plugin-installers.tgz: $(wildcard ../plugins/*)
docker run --rm -i -w /v \
Expand Down
11 changes: 11 additions & 0 deletions deb/build-deb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
set -x
set -e

# untar sources
mkdir -p /root/build-deb/engine
tar -C /root/build-deb -xzf /sources/engine.tgz
mkdir -p /root/build-deb/cli
tar -C /root/build-deb -xzf /sources/cli.tgz

# link them to their canonical path
mkdir -p /go/src/github.com/docker
ln -snf /root/build-deb/engine /go/src/github.com/docker/docker
ln -snf /root/build-deb/cli /go/src/github.com/docker/cli

EPOCH="${EPOCH:-}"
EPOCH_SEP=""
if [[ ! -z "$EPOCH" ]]; then
Expand Down
15 changes: 13 additions & 2 deletions deb/common/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@ Source: docker-ce
Section: admin
Priority: optional
Maintainer: Docker <support@docker.com>
Build-Depends: bash-completion,
Build-Depends: bash,
bash-completion,
libbtrfs-dev | btrfs-tools,
ca-certificates,
cmake,
dh-apparmor,
dh-systemd,
gcc,
git,
libc-dev,
libdevmapper-dev,
libltdl-dev,
libseccomp-dev,
libseccomp2,
libsystemd-dev,
libtool,
make,
gcc
pkg-config
Standards-Version: 3.9.6
Homepage: https://www.docker.com
Vcs-Browser: https://github.com/docker/docker
Expand Down
24 changes: 0 additions & 24 deletions deb/common/docker-ce.postinst
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@
#!/bin/sh
set -e

update_dockerd() {
dbefile=/var/lib/docker-engine/distribution_based_engine.json
URL=https://docs.docker.com/releasenote
if [ -f "${dbefile}" ] && sed -e 's/.*"platform"[ \t]*:[ \t]*"\([^"]*\)".*/\1/g' "${dbefile}"| grep -v -i community > /dev/null; then
echo
echo
echo
echo "Warning: Your engine has been activated to Docker Engine - Enterprise but you are still using Community packages"
echo "You can use the 'docker engine update' command to update your system, or switch to using the Enterprise packages."
echo "See $URL for more details."
echo
echo
echo
else
rm -f /usr/bin/dockerd
update-alternatives --install /usr/bin/dockerd dockerd /usr/bin/dockerd-ce 1 --slave \
${dbefile} distribution_based_engine.json /var/lib/docker-engine/distribution_based_engine-ce.json
fi
}

case "$1" in
configure)
if [ -z "$2" ]; then
if ! getent group docker > /dev/null; then
groupadd --system docker
fi
fi
update_dockerd
;;
update)
update_dockerd
;;
abort-*)
# How'd we get here??
Expand Down
6 changes: 0 additions & 6 deletions deb/common/docker-ce.prerm

This file was deleted.

19 changes: 15 additions & 4 deletions deb/common/rules
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
#!/usr/bin/make -f

VERSION ?= $(shell cat engine/VERSION)
DOCKER_GOPATH := /go/src/github.com/docker

override_dh_gencontrol:
# if we're on Ubuntu, we need to Recommends: apparmor
echo 'apparmor:Recommends=$(shell dpkg-vendor --is Ubuntu && echo apparmor)' >> debian/docker-ce.substvars
dh_gencontrol

override_dh_auto_build:
# Build the daemon and dependencies
cd engine && PRODUCT=docker ./hack/make.sh dynbinary
cd engine && TMP_GOPATH="/go" hack/dockerfile/install/install.sh tini
cd engine && TMP_GOPATH="/go" hack/dockerfile/install/install.sh proxy dynamic
# Build the CLI
cd /go/src/github.com/docker/cli && \
LDFLAGS='' DISABLE_WARN_OUTSIDE_CONTAINER=1 make VERSION=$(VERSION) GITCOMMIT=$(DOCKER_GITCOMMIT) dynbinary manpages
# Build the CLI plugins
# Make sure to set LDFLAGS="" since, dpkg-buildflags sets it to some weird values
set -e;cd /sources && \
tar xzf plugin-installers.tgz; \
for installer in plugins/*.installer; do \
LDFLAGS='' bash $${installer} build; \
done

override_dh_auto_test:
./engine/bundles/dynbinary-daemon/dockerd -v
./cli/build/docker -v

override_dh_strip:
# Go has lots of problems with stripping, so just don't

Expand All @@ -35,10 +46,10 @@ override_dh_auto_install:
# docker-ce install
install -D -m 0644 /sources/docker.service debian/docker-ce/lib/systemd/system/docker.service
install -D -m 0644 /sources/docker.socket debian/docker-ce/lib/systemd/system/docker.socket
install -D -m 0755 /source/dockerd debian/docker-ce/usr/bin/dockerd-ce
install -D -m 0755 /source/docker-proxy debian/docker-ce/usr/bin/docker-proxy
install -D -m 0755 /source/docker-init debian/docker-ce/usr/bin/docker-init
install -D -m 0644 /sources/distribution_based_engine.json debian/docker-ce/var/lib/docker-engine/distribution_based_engine-ce.json
install -D -m 0755 $(shell readlink -e engine/bundles/dynbinary-daemon/dockerd) debian/docker-ce/usr/bin/dockerd
install -D -m 0755 /usr/local/bin/docker-proxy debian/docker-ce/usr/bin/docker-proxy
install -D -m 0755 /usr/local/bin/docker-init debian/docker-ce/usr/bin/docker-init
install -D -m 0644 /sources/distribution_based_engine.json debian/docker-ce/var/lib/docker-engine/distribution_based_engine.json

override_dh_installinit:
# use "docker" as our service name, not "docker-ce"
Expand Down
9 changes: 0 additions & 9 deletions deb/debian-buster/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ARG GO_IMAGE
ARG BUILD_IMAGE=debian:buster
ARG ENGINE_IMAGE
FROM ${GO_IMAGE} as golang
FROM ${ENGINE_IMAGE} as engine

FROM ${BUILD_IMAGE}

Expand All @@ -18,19 +16,12 @@ ARG COMMON_FILES
COPY ${COMMON_FILES} /root/build-deb/debian
RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control

# Copy our sources and untar them
COPY sources/ /sources
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/

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

ENV DISTRO debian
ENV SUITE buster

COPY --from=golang /usr/local/go /usr/local/go
COPY --from=engine /bin/dockerd /source/
COPY --from=engine /bin/docker-proxy /source/
COPY --from=engine /bin/docker-init /source/

WORKDIR /root/build-deb
COPY build-deb /root/build-deb/build-deb
Expand Down
9 changes: 0 additions & 9 deletions deb/debian-stretch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ARG GO_IMAGE
ARG ENGINE_IMAGE
ARG BUILD_IMAGE=debian:stretch
FROM ${GO_IMAGE} as golang
FROM ${ENGINE_IMAGE} as engine

FROM ${BUILD_IMAGE}

Expand All @@ -18,19 +16,12 @@ ARG COMMON_FILES
COPY ${COMMON_FILES} /root/build-deb/debian
RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control

# Copy our sources and untar them
COPY sources/ /sources
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/

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

ENV DISTRO debian
ENV SUITE stretch

COPY --from=golang /usr/local/go /usr/local/go
COPY --from=engine /bin/dockerd /source/
COPY --from=engine /bin/docker-proxy /source/
COPY --from=engine /bin/docker-init /source/

WORKDIR /root/build-deb
COPY build-deb /root/build-deb/build-deb
Expand Down
9 changes: 0 additions & 9 deletions deb/raspbian-stretch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ARG GO_IMAGE
ARG ENGINE_IMAGE
ARG BUILD_IMAGE=resin/rpi-raspbian:stretch
FROM ${GO_IMAGE} as golang
FROM ${ENGINE_IMAGE} as engine

FROM ${BUILD_IMAGE}

Expand All @@ -18,19 +16,12 @@ ARG COMMON_FILES
COPY ${COMMON_FILES} /root/build-deb/debian
RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control

# Copy our sources and untar them
COPY sources/ /sources
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/

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

ENV DISTRO raspbian
ENV SUITE stretch

COPY --from=golang /usr/local/go /usr/local/go
COPY --from=engine /bin/dockerd /source/
COPY --from=engine /bin/docker-proxy /source/
COPY --from=engine /bin/docker-init /source/

WORKDIR /root/build-deb
COPY build-deb /root/build-deb/build-deb
Expand Down
9 changes: 0 additions & 9 deletions deb/ubuntu-bionic/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ARG GO_IMAGE
ARG ENGINE_IMAGE
ARG BUILD_IMAGE=ubuntu:bionic
FROM ${GO_IMAGE} as golang
FROM ${ENGINE_IMAGE} as engine

FROM ${BUILD_IMAGE}

Expand All @@ -18,19 +16,12 @@ ARG COMMON_FILES
COPY ${COMMON_FILES} /root/build-deb/debian
RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control

# Copy our sources and untar them
COPY sources/ /sources
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/

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

ENV DISTRO ubuntu
ENV SUITE bionic

COPY --from=golang /usr/local/go /usr/local/go
COPY --from=engine /bin/dockerd /source/
COPY --from=engine /bin/docker-proxy /source/
COPY --from=engine /bin/docker-init /source/

WORKDIR /root/build-deb
COPY build-deb /root/build-deb/build-deb
Expand Down
9 changes: 0 additions & 9 deletions deb/ubuntu-cosmic/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ARG GO_IMAGE
ARG ENGINE_IMAGE
ARG BUILD_IMAGE=ubuntu:cosmic
FROM ${GO_IMAGE} as golang
FROM ${ENGINE_IMAGE} as engine

FROM ${BUILD_IMAGE}

Expand All @@ -18,19 +16,12 @@ ARG COMMON_FILES
COPY ${COMMON_FILES} /root/build-deb/debian
RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control

# Copy our sources and untar them
COPY sources/ /sources
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/

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

ENV DISTRO ubuntu
ENV SUITE cosmic

COPY --from=golang /usr/local/go /usr/local/go
COPY --from=engine /bin/dockerd /source/
COPY --from=engine /bin/docker-proxy /source/
COPY --from=engine /bin/docker-init /source/

WORKDIR /root/build-deb
COPY build-deb /root/build-deb/build-deb
Expand Down
9 changes: 0 additions & 9 deletions deb/ubuntu-disco/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ARG GO_IMAGE
ARG ENGINE_IMAGE
ARG BUILD_IMAGE=ubuntu:disco
FROM ${GO_IMAGE} as golang
FROM ${ENGINE_IMAGE} as engine

FROM ${BUILD_IMAGE}

Expand All @@ -18,19 +16,12 @@ ARG COMMON_FILES
COPY ${COMMON_FILES} /root/build-deb/debian
RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control

# Copy our sources and untar them
COPY sources/ /sources
RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/

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

ENV DISTRO ubuntu
ENV SUITE disco

COPY --from=golang /usr/local/go /usr/local/go
COPY --from=engine /bin/dockerd /source/
COPY --from=engine /bin/docker-proxy /source/
COPY --from=engine /bin/docker-init /source/

WORKDIR /root/build-deb
COPY build-deb /root/build-deb/build-deb
Expand Down
Loading