Simplify makefiles in rootfs folders

pull/316/head
jackgr 9 years ago
parent 250a2ddba5
commit c9aac9e530

@ -12,27 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
DOCKER_REGISTRY := gcr.io
PREFIX := $(DOCKER_REGISTRY)/$(PROJECT)
IMAGE ?= expandybird
TAG ?= git-$(shell git rev-parse --short HEAD)
FULL_IMAGE := $(PREFIX)/$(IMAGE)
.PHONY: container
container: binary expansion
docker build -t $(FULL_IMAGE):latest -f Dockerfile .
docker tag $(FULL_IMAGE):latest $(FULL_IMAGE):$(TAG)
include ../include.mk
.PHONY: push
push: container
ifeq ($(DOCKER_REGISTRY),gcr.io)
gcloud docker push $(PREFIX)/$(IMAGE):$(TAG)
else
docker push $(PREFIX)/$(IMAGE):$(TAG)
endif
.PHONY: extras
extras: expansion
.PHONY: expansion
expansion:
cp -R ../../expansion ./opt
binary:
cp ../../bin/linux-amd64/expandybird ./bin

@ -0,0 +1,69 @@
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# If you update this image please check the tag value before pushing.
DOCKER_REGISTRY ?= gcr.io
PREFIX := $(DOCKER_REGISTRY)/$(PROJECT)
FULL_IMAGE := $(PREFIX)/$(IMAGE)
TAG ?= git-$(shell git rev-parse --short HEAD)
DEFAULT_PLATFORM := $(shell uname | tr '[:upper:]' '[:lower:]')
PLATFORM ?= $(DEFAULT_PLATFORM)
DEFAULT_ARCH := $(shell uname -m)
ARCH ?= $(DEFAULT_ARCH)
.PHONY: info
info:
@echo "Build tag: ${TAG}"
@echo "Registry: ${DOCKER_REGISTRY}"
@echo "Project: ${PROJECT}"
@echo "Image: ${IMAGE}"
@echo "Platform: ${PLATFORM}"
@echo "Arch: ${ARCH}"
.PHONY : .project
.PHONY: push
push: container
ifeq ($(DOCKER_REGISTRY),gcr.io)
gcloud docker push $(FULL_IMAGE):$(TAG)
else
docker push $(FULL_IMAGE):$(TAG)
endif
.PHONY: container
container: .project .docker binary extras
docker build -t $(FULL_IMAGE):latest -f Dockerfile .
docker tag -f $(FULL_IMAGE):latest $(FULL_IMAGE):$(TAG)
.project:
@if [[ -z "${PROJECT}" ]]; then echo "PROJECT variable must be set"; exit 1; fi
.docker:
@if [[ -z `which docker` ]] || ! docker version &> /dev/null; then echo "docker is not installed correctly"; exit 1; fi
CROSS_IMAGE := $(PLATFORM)-$(ARCH)/$(IMAGE)/$(IMAGE)
.PHONY: binary
binary:
@if [[ -z $(CROSS_IMAGE) ]]; then \
echo cp ../../bin/$(CROSS_IMAGE) ./bin ; \
cp ../../bin/$(CROSS_IMAGE) ./bin ; \
else \
echo cp ../../bin/$(IMAGE) ./bin ; \
cp ../../bin/$(IMAGE) ./bin ; \
fi

@ -12,30 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
DOCKER_REGISTRY := gcr.io
PREFIX := $(DOCKER_REGISTRY)/$(PROJECT)
IMAGE ?= manager
TAG ?= git-$(shell git rev-parse --short HEAD)
FULL_IMAGE := $(PREFIX)/$(IMAGE)
KUBE_VERSION ?= v1.1.7
.PHONY: container
container: binary kubectl
docker build -t $(FULL_IMAGE):latest -f Dockerfile .
docker tag $(FULL_IMAGE):latest $(FULL_IMAGE):$(TAG)
.PHONY: push
push: container
ifeq ($(DOCKER_REGISTRY),gcr.io)
gcloud docker push $(PREFIX)/$(IMAGE):$(TAG)
else
docker push $(PREFIX)/$(IMAGE):$(TAG)
endif
include ../include.mk
binary:
cp ../../bin/linux-amd64/manager ./bin
.PHONY: extras
extras: kubectl
.PHONY: kubectl
kubectl:
curl -fsSL -o bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl
chmod +x bin/kubectl

@ -12,30 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
DOCKER_REGISTRY := gcr.io
PREFIX := $(DOCKER_REGISTRY)/$(PROJECT)
IMAGE ?= resourcifier
TAG ?= git-$(shell git rev-parse --short HEAD)
FULL_IMAGE := $(PREFIX)/$(IMAGE)
KUBE_VERSION ?= v1.1.7
KUBE_VERSION ?= v1.1.7
include ../include.mk
.PHONY: container
container: binary kubectl
docker build -t $(FULL_IMAGE):latest -f Dockerfile .
docker tag $(FULL_IMAGE):latest $(FULL_IMAGE):$(TAG)
.PHONY: extras
extras: expansion kubectl
.PHONY: push
push: container
ifeq ($(DOCKER_REGISTRY),gcr.io)
gcloud docker push $(PREFIX)/$(IMAGE):$(TAG)
else
docker push $(PREFIX)/$(IMAGE):$(TAG)
endif
binary:
cp ../../bin/linux-amd64/resourcifier ./bin
.PHONY: expansion
expansion:
cp -R ../../expansion ./opt
.PHONY: kubectl
kubectl:
curl -fsSL -o bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl
chmod +x bin/kubectl
Loading…
Cancel
Save