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

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