From 3cdf4cb3f436f2e66af64175ed12edd8bb6b061e Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Mon, 29 Feb 2016 18:01:56 -0800 Subject: [PATCH] feat(images): initial pass at new Dockerfiles --- .../requirements.txt | 0 rootfs/expandybird/Dockerfile | 24 +++++++++++++++++ rootfs/expandybird/Makefile | 24 +++++++++++++++++ rootfs/manager/Dockerfile | 4 +++ rootfs/manager/Makefile | 27 +++++++++++++++++++ rootfs/resourcifer/Dockerfile | 4 +++ rootfs/resourcifer/Makefile | 27 +++++++++++++++++++ 7 files changed, 110 insertions(+) rename {cmd/expandybird => expansion}/requirements.txt (100%) create mode 100644 rootfs/expandybird/Dockerfile create mode 100644 rootfs/expandybird/Makefile create mode 100644 rootfs/manager/Dockerfile create mode 100644 rootfs/manager/Makefile create mode 100644 rootfs/resourcifer/Dockerfile create mode 100644 rootfs/resourcifer/Makefile diff --git a/cmd/expandybird/requirements.txt b/expansion/requirements.txt similarity index 100% rename from cmd/expandybird/requirements.txt rename to expansion/requirements.txt diff --git a/rootfs/expandybird/Dockerfile b/rootfs/expandybird/Dockerfile new file mode 100644 index 000000000..cea99a7cd --- /dev/null +++ b/rootfs/expandybird/Dockerfile @@ -0,0 +1,24 @@ +FROM alpine:3.3 + +COPY . / + +# install common packages +RUN apk add --update-cache curl python + +WORKDIR /opt + +# install pip +RUN curl -sSL https://raw.githubusercontent.com/pypa/pip/7.1.2/contrib/get-pip.py | python - + +# install dependencies +RUN pip install --disable-pip-version-check --no-cache-dir -r /opt/expansion/requirements.txt + +# cleanup. +RUN apk del --purge \ + curl \ + python \ + && rm -rf /var/cache/apk/* + +# define execution environment +CMD ["/bin/expandybird", "-expansion_binary", "/opt/expansion/expansion.py"] +EXPOSE 8000 diff --git a/rootfs/expandybird/Makefile b/rootfs/expandybird/Makefile new file mode 100644 index 000000000..e293f49af --- /dev/null +++ b/rootfs/expandybird/Makefile @@ -0,0 +1,24 @@ +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) + +.PHONY: push +push: container +ifeq ($(DOCKER_REGISTRY),gcr.io) + gcloud docker push $(PREFIX)/$(IMAGE):$(TAG) +else + docker push $(PREFIX)/$(IMAGE):$(TAG) +endif + +expansion: + cp -R ../../expansion ./opt + +binary: + cp ../../bin/linux-amd64/expandybird ./bin diff --git a/rootfs/manager/Dockerfile b/rootfs/manager/Dockerfile new file mode 100644 index 000000000..55bbe6b67 --- /dev/null +++ b/rootfs/manager/Dockerfile @@ -0,0 +1,4 @@ +FROM alpine:3.3 +COPY . / +EXPOSE 8080 +CMD ["/bin/manager", "--kubectl=/bin/kubectl"] diff --git a/rootfs/manager/Makefile b/rootfs/manager/Makefile new file mode 100644 index 000000000..886ca837a --- /dev/null +++ b/rootfs/manager/Makefile @@ -0,0 +1,27 @@ +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 + +binary: + cp ../../bin/linux-amd64/manager ./bin + +kubectl: + curl -fsSL -o bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl + chmod +x bin/kubectl diff --git a/rootfs/resourcifer/Dockerfile b/rootfs/resourcifer/Dockerfile new file mode 100644 index 000000000..fca4437c3 --- /dev/null +++ b/rootfs/resourcifer/Dockerfile @@ -0,0 +1,4 @@ +FROM alpine:3.3 +COPY . / +EXPOSE 8080 +CMD ["/bin/resourcifier", "--kubectl=/bin/kubectl"] diff --git a/rootfs/resourcifer/Makefile b/rootfs/resourcifer/Makefile new file mode 100644 index 000000000..56a21da77 --- /dev/null +++ b/rootfs/resourcifer/Makefile @@ -0,0 +1,27 @@ +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 + +.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 + +binary: + cp ../../bin/linux-amd64/resourcifier ./bin + +kubectl: + curl -fsSL -o bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl + chmod +x bin/kubectl