From 60626e32244e0de3d9aad5cfbc473d0d9fdbb7ec Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Wed, 6 Jul 2016 14:55:00 +0200 Subject: [PATCH] Add dockerfile for a "calicokube" Signed-off-by: Bogdan Dobrelya --- Dockerfile | 9 +++++++++ Makefile | 11 +++++++++-- README.md | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..dde3f034f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM debian:jessie +MAINTAINER projectcalico + +RUN mkdir -p /opt/cni/bin +ADD ./dist/calico /opt/cni/bin +ADD ./dist/calico-ipam /opt/cni/bin +VOLUME /opt/cni +ENV PATH=$PATH:/opt/cni/bin +WORKDIR /opt/cni/bin diff --git a/Makefile b/Makefile index 23c8b64e9..7aebb7ba2 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ # Version of calico/build to use. BUILD_VERSION=latest +CALICO_VERSION=$(shell git describe --tags) SRCFILES=$(shell find calico_cni -type f ! -path calico_cni/version.py) calico.py ipam.py LOCAL_IP_ENV?=$(shell ip route get 8.8.8.8 | head -1 | cut -d' ' -f8) @@ -9,8 +10,9 @@ LOCAL_IP_ENV?=$(shell ip route get 8.8.8.8 | head -1 | cut -d' ' -f8) K8S_VERSION=1.2.0 default: all -all: binary test +all: docker test binary: update-version dist/calico dist/calico-ipam +docker: binary dist/docker test: ut fv plugin: dist/calico ipam: dist/calico-ipam @@ -30,11 +32,16 @@ dist/calico-ipam: $(SRCFILES) calico/build:$(BUILD_VERSION) \ pyinstaller ipam.py -ayF -n calico-ipam +# Makes a docker image +dist/docker: + docker build -t calico/cni . + docker tag calico/cni calico/cni:$(CALICO_VERSION) + # Updates the version information in version.py update-version: echo "# Auto-generated contents. Do not manually edit" > calico_cni/version.py echo "# or check in this file." >> calico_cni/version.py - echo "__version__ = '$(shell git describe --tags)'" >> calico_cni/version.py + echo "__version__ = '${CALICO_VERSION}'" >> calico_cni/version.py echo "__commit__ = '$(shell git rev-parse HEAD)'" >> calico_cni/version.py echo "__branch__ = '$(shell git rev-parse --abbrev-ref HEAD)'" >> calico_cni/version.py diff --git a/README.md b/README.md index 17e299180..d5c24c69c 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ To build the Calico Networking Plugin for CNI locally, clone this repository and - To just build the binaries, with no tests, run `make binary`. This will produce `dist/calico` and `dist/calico-ipam`. - To only run the unit tests, simply run `make ut`. - To only run the fv tests, simply run `make fv`. +- To build the docker image, run `make docker`. [cni]: https://github.com/appc/cni [config]: configuration.md