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

Commit

Permalink
Merge pull request #41 from andrewhsu/update-pack
Browse files Browse the repository at this point in the history
update with latest changes from docker-ce-packaging
  • Loading branch information
andrewhsu authored Jun 6, 2017
2 parents 00327e2 + b5411da commit de513d0
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 22 deletions.
16 changes: 8 additions & 8 deletions components/packaging/deb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CLI_DIR:=$(CURDIR)/../../cli
GITCOMMIT?=$(shell cd $(ENGINE_DIR) && git rev-parse --short HEAD)
VERSION?=$(shell cat $(ENGINE_DIR)/VERSION)
DOCKER_EXPERIMENTAL:=0
CHOWN:=docker run --rm -i -t -v $(CURDIR):/v -w /v $(ALPINE) chown
CHOWN:=docker run --rm -i -v $(CURDIR):/v -w /v $(ALPINE) chown

.PHONY: help clean deb ubuntu debian ubuntu-xenial ubuntu-trusty ubuntu-yakkety ubuntu-zesty debian-jessie debian-stretch debian-wheezy

Expand All @@ -25,7 +25,7 @@ debian: debian-stretch debian-wheezy debian-jessie ## build all debian deb packa

ubuntu-xenial: ## build ubuntu xenial deb packages
docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) .
docker run --rm -i -t \
docker run --rm -i \
-e VERSION=$(VERSION) \
-e DOCKER_GITCOMMIT=$(GITCOMMIT) \
-v $(CURDIR)/debbuild/$@:/build \
Expand All @@ -36,7 +36,7 @@ ubuntu-xenial: ## build ubuntu xenial deb packages

ubuntu-trusty: ## build ubuntu trusty deb packages
docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) .
docker run --rm -i -t \
docker run --rm -i \
-e VERSION=$(VERSION) \
-e DOCKER_GITCOMMIT=$(GITCOMMIT) \
-v $(CURDIR)/debbuild/$@:/build \
Expand All @@ -47,7 +47,7 @@ ubuntu-trusty: ## build ubuntu trusty deb packages

ubuntu-yakkety: ## build ubuntu yakkety deb packages
docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) .
docker run --rm -i -t \
docker run --rm -i \
-e VERSION=$(VERSION) \
-e DOCKER_GITCOMMIT=$(GITCOMMIT) \
-v $(CURDIR)/debbuild/$@:/build \
Expand All @@ -58,7 +58,7 @@ ubuntu-yakkety: ## build ubuntu yakkety deb packages

ubuntu-zesty: ## build ubuntu zesty deb packages
docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) .
docker run --rm -i -t \
docker run --rm -i \
-e VERSION=$(VERSION) \
-e DOCKER_GITCOMMIT=$(GITCOMMIT) \
-v $(CURDIR)/debbuild/$@:/build \
Expand All @@ -69,7 +69,7 @@ ubuntu-zesty: ## build ubuntu zesty deb packages

debian-jessie: ## build debian jessie deb packages
docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) .
docker run --rm -i -t \
docker run --rm -i \
-e VERSION=$(VERSION) \
-e DOCKER_GITCOMMIT=$(GITCOMMIT) \
-v $(CURDIR)/debbuild/$@:/build \
Expand All @@ -80,7 +80,7 @@ debian-jessie: ## build debian jessie deb packages

debian-stretch: ## build debian stretch deb packages
docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) .
docker run --rm -i -t \
docker run --rm -i \
-e VERSION=$(VERSION) \
-e DOCKER_GITCOMMIT=$(GITCOMMIT) \
-v $(CURDIR)/debbuild/$@:/build \
Expand All @@ -91,7 +91,7 @@ debian-stretch: ## build debian stretch deb packages

debian-wheezy: ## build debian wheezy deb packages
docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) .
docker run --rm -i -t \
docker run --rm -i \
-e VERSION=$(VERSION) \
-e DOCKER_GITCOMMIT=$(GITCOMMIT) \
-v $(CURDIR)/debbuild/$@:/build \
Expand Down
4 changes: 1 addition & 3 deletions components/packaging/deb/ubuntu-xenial/Dockerfile.s390x
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools bu

ENV GO_VERSION 1.8.3
RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local
ENV PATH $PATH:/usr/local/go/bin

ENV GOPATH /go

ENV PATH $PATH:/usr/local/go/bin:/$GOPATH/bin
ENV DOCKER_BUILDTAGS apparmor pkcs11 selinux
ENV RUNC_BUILDTAGS apparmor selinux

Expand Down
4 changes: 1 addition & 3 deletions components/packaging/deb/ubuntu-yakkety/Dockerfile.s390x
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools bu

ENV GO_VERSION 1.8.3
RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local
ENV PATH $PATH:/usr/local/go/bin

ENV GOPATH /go

ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
ENV DOCKER_BUILDTAGS apparmor pkcs11 selinux
ENV RUNC_BUILDTAGS apparmor selinux

Expand Down
4 changes: 1 addition & 3 deletions components/packaging/deb/ubuntu-zesty/Dockerfile.s390x
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools bu

ENV GO_VERSION 1.8.3
RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local
ENV PATH $PATH:/usr/local/go/bin

ENV GOPATH /go

ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux
ENV RUNC_BUILDTAGS apparmor seccomp selinux

Expand Down
8 changes: 4 additions & 4 deletions components/packaging/rpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ GITCOMMIT=$(shell cd $(ENGINE_DIR) && git rev-parse --short HEAD)
VERSION=$(shell cat $(ENGINE_DIR)/VERSION)
DOCKER_EXPERIMENTAL=0
GEN_RPM_VER=$(shell ./gen-rpm-ver $(ENGINE_DIR) $(VERSION))
CHOWN=docker run --rm -i -t -v $(CURDIR):/v -w /v alpine chown
RPMBUILD=docker run --privileged --rm -i -t \
CHOWN=docker run --rm -i -v $(CURDIR):/v -w /v alpine chown
RPMBUILD=docker run --privileged --rm -i \
-v $(CURDIR)/rpmbuild/SOURCES:/root/rpmbuild/SOURCES \
-v $(CURDIR)/rpmbuild/BUILD:/root/rpmbuild/BUILD \
-v $(CURDIR)/rpmbuild/BUILDROOT:/root/rpmbuild/BUILDROOT \
Expand Down Expand Up @@ -52,15 +52,15 @@ centos-7: rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build centos-7

rpmbuild/SOURCES/cli.tgz:
mkdir -p rpmbuild/SOURCES
docker run --rm -i -t -w /v \
docker run --rm -i -w /v \
-v $(CLI_DIR):/cli \
-v $(CURDIR)/rpmbuild/SOURCES:/v \
alpine \
tar -C / -c -z -f /v/cli.tgz --exclude .git cli

rpmbuild/SOURCES/engine.tgz:
mkdir -p rpmbuild/SOURCES
docker run --rm -i -t -w /v \
docker run --rm -i -w /v \
-v $(ENGINE_DIR):/engine \
-v $(CURDIR)/rpmbuild/SOURCES:/v \
alpine \
Expand Down
12 changes: 11 additions & 1 deletion components/packaging/static/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ CLI_DIR:=$(CURDIR)/../../cli
ENGINE_VER=$(shell cat $(ENGINE_DIR)/VERSION)
VERSION=$(shell cat $(ENGINE_DIR)/VERSION)
CHOWN=docker run --rm -v $(CURDIR):/v -w /v alpine chown
HASH_CMD=docker run -v $(CURDIR):/sum -w /sum debian:jessie bash hash_files
DIR_TO_HASH:=build/linux

.PHONY: help clean static static-linux cross-mac cross-win cross-arm static-cli static-engine cross-all-cli cross-win-engine
.PHONY: help clean static static-linux cross-mac cross-win cross-arm static-cli static-engine cross-all-cli cross-win-engine hash_files

help: ## show make targets
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
Expand All @@ -23,23 +25,31 @@ static-linux: static-cli static-engine ## create tgz with linux x86_64 client an
cp $(ENGINE_DIR)/bundles/$(ENGINE_VER)/binary-daemon/$$f build/linux/docker; \
done
tar -C build/linux -c -z -f build/linux/docker-$(VERSION).tgz docker
$(HASH_CMD) build/linux

hash_files:
@echo "Hashing directory $(DIR_TO_HASH)"
$(HASH_CMD) "$(DIR_TO_HASH)"

cross-mac: cross-all-cli ## create tgz with darwin x86_64 client only
mkdir -p build/mac/docker
cp $(CLI_DIR)/build/docker-darwin-amd64 build/mac/docker/docker
tar -C build/mac -c -z -f build/mac/docker-$(VERSION).tgz docker
$(HASH_CMD) build/mac

cross-win: cross-all-cli cross-win-engine ## create zip file with windows x86_64 client and server
mkdir -p build/win/docker
cp $(CLI_DIR)/build/docker-windows-amd64 build/win/docker/docker.exe
cp $(ENGINE_DIR)/bundles/$(ENGINE_VER)/cross/windows/amd64/dockerd-$(ENGINE_VER).exe build/win/docker/dockerd.exe
docker run --rm -v $(CURDIR)/build/win:/v -w /v alpine sh -c 'apk update&&apk add zip&&zip -r docker-$(VERSION).zip docker'
$(CHOWN) -R $(shell id -u):$(shell id -g) build
$(HASH_CMD) bash hash_files build/win

cross-arm: cross-all-cli ## create tgz with linux armhf client only
mkdir -p build/arm/docker
cp $(CLI_DIR)/build/docker-linux-arm build/arm/docker/docker
tar -C build/arm -c -z -f build/arm/docker-$(VERSION).tgz docker
$(HASH_CMD) build/arm

static-cli:
$(MAKE) -C $(CLI_DIR) -f docker.Makefile VERSION=$(VERSION) build
Expand Down
11 changes: 11 additions & 0 deletions components/packaging/static/hash_files
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

# Simple script to hash all the files in a given directory

DIR_TO_LOOK_IN=${1:-build/linux}

for f in $(find "$DIR_TO_LOOK_IN" -type f); do
for hash_algo in md5 sha256; do
"${hash_algo}sum" "$f" > "$f.$hash_algo"
done
done

0 comments on commit de513d0

Please sign in to comment.