2016-01-05 08:52:12 +00:00
|
|
|
# Build the etcd image
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# [TAG=2.2.1] [REGISTRY=gcr.io/google_containers] [ARCH=amd64] [BASEIMAGE=busybox] make (build|push)
|
2015-04-02 23:20:09 +00:00
|
|
|
|
2016-01-05 08:52:12 +00:00
|
|
|
TAG?=2.2.1
|
|
|
|
ARCH?=amd64
|
|
|
|
REGISTRY?=gcr.io/google_containers
|
|
|
|
TEMP_DIR:=$(shell mktemp -d)
|
2015-04-02 23:20:09 +00:00
|
|
|
|
2016-01-05 08:52:12 +00:00
|
|
|
# Default base images for different architectures
|
|
|
|
# '/' in images has to be written as '\\/'
|
|
|
|
ifeq ($(ARCH),amd64)
|
|
|
|
BASEIMAGE?=busybox
|
|
|
|
endif
|
|
|
|
ifeq ($(ARCH),arm)
|
|
|
|
BASEIMAGE?=hypriot\\/armhf-busybox
|
|
|
|
endif
|
2015-04-02 23:20:09 +00:00
|
|
|
|
2016-01-05 08:52:12 +00:00
|
|
|
build:
|
|
|
|
# Download etcd source in a golang container and cross-compile it statically
|
|
|
|
# or download official binaries if the ARCH is amd64
|
|
|
|
./build-etcd.sh ${TAG} ${ARCH} ${TEMP_DIR}
|
|
|
|
|
|
|
|
# Copy the content in this dir to the temp dir
|
|
|
|
cp ./* ${TEMP_DIR}
|
|
|
|
|
|
|
|
# Replace BASEIMAGE with the real base image
|
|
|
|
cd ${TEMP_DIR} && sed -i "s/BASEIMAGE/${BASEIMAGE}/g" Dockerfile
|
|
|
|
|
|
|
|
# And build the image
|
|
|
|
docker build -t ${REGISTRY}/etcd-${ARCH}:${TAG} ${TEMP_DIR}
|
|
|
|
|
|
|
|
ifeq ($(ARCH),amd64)
|
|
|
|
# Backward compatability. TODO: deprecate this image tag
|
|
|
|
docker tag -f ${REGISTRY}/etcd-${ARCH}:${TAG} ${REGISTRY}/etcd:${TAG}
|
|
|
|
endif
|
2015-04-02 23:20:09 +00:00
|
|
|
|
2015-06-08 23:34:27 +00:00
|
|
|
push: build
|
2016-01-05 08:52:12 +00:00
|
|
|
gcloud docker push ${REGISTRY}/etcd-${ARCH}:${TAG}
|
|
|
|
|
|
|
|
# Backward compatability. TODO: deprecate this image tag
|
|
|
|
ifeq ($(ARCH),amd64)
|
|
|
|
gcloud docker push ${REGISTRY}/etcd:${TAG}
|
|
|
|
endif
|
2015-04-02 23:20:09 +00:00
|
|
|
|
2016-01-05 08:52:12 +00:00
|
|
|
all: build
|
|
|
|
.PHONY: build push
|