Forráskód Böngészése

Top-level Dockerfile will build using golang:onbuild

dist/build-docker has been added to produce images
based on flannelbox.

Fixes #75
Eugene Yakubovich 10 éve
szülő
commit
44e4baf09d
4 módosított fájl, 28 hozzáadás és 15 törlés
  1. 1 7
      Dockerfile
  2. 6 7
      README.md
  3. 21 0
      dist/build-docker
  4. 0 1
      dist/publish

+ 1 - 7
Dockerfile

@@ -1,7 +1 @@
-FROM quay.io/coreos/flannelbox:1.0
-
-MAINTAINER Eugene Yakubovich <eugene.yakubovich@coreos.com>
-
-ADD ./bin/flanneld /opt/bin/
-
-CMD /opt/bin/flanneld
+FROM golang:onbuild

+ 6 - 7
README.md

@@ -27,19 +27,18 @@ overlay network:
 * Step 2: Git clone the flannel repo: ```https://github.com/coreos/flannel.git```
 * Step 3: Run the build script: ```cd flannel; ./build```
 
-Alternatively, you can build flannel in a docker container with the following command. Replace $SRC with the absolute path to your flannel source code:
+### Building in a Docker container
 
+For quick testing, you can build flannel inside a Docker container (such container will retain its build environment):
 ```
-docker run -v $SRC:/opt/flannel -i -t google/golang /bin/bash -c "cd /opt/flannel && ./build"
+docker build .
 ```
 
-## Packaging flannel into Docker container
-Once flannel has been built (see above), you can optionally put it into a Docker container.
-The source tree contains Dockerfile at top level. Changed into that directory and replacing $TAG
-with a tag for the image, run:
+If you would like to build inside a Docker container but to produce a binary on your host:
 
 ```
-docker build -t $TAG .
+# Replace $SRC with the absolute path to your flannel source code
+docker run -v $SRC:/opt/flannel -i -t google/golang /bin/bash -c "cd /opt/flannel && ./build"
 ```
 
 ## Configuration

+ 21 - 0
dist/build-docker

@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [ $# -ne 1 ]; then
+	echo "Usage: $0 tag" >/dev/stderr
+	exit 1
+fi
+
+tag=$1
+
+tgt=$(mktemp -d)
+
+cat <<DF >${tgt}/Dockerfile
+FROM quay.io/coreos/flannelbox:1.0
+MAINTAINER Eugene Yakubovich <eugene.yakubovich@coreos.com>
+ADD ./flanneld /opt/bin/
+CMD /opt/bin/flanneld
+DF
+
+cp ../bin/flanneld $tgt
+docker build -t quay.io/coreos/flannel:${tag} $tgt
+rm -rf $tgt

+ 0 - 1
dist/publish

@@ -7,5 +7,4 @@ fi
 
 TAG=$1
 
-docker build -t quay.io/coreos/flannel:$TAG .
 docker push quay.io/coreos/flannel:$TAG