diff --git a/Dockerfile b/Dockerfile index b6dd065d8..e4374806e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM treeder/dind +FROM funcy/dind WORKDIR /app diff --git a/Makefile b/Makefile index e0c7f103a..ec083ab63 100644 --- a/Makefile +++ b/Makefile @@ -29,10 +29,10 @@ docker-dep: docker-build: docker pull funcy/go:dev docker run --rm -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions -w /go/src/gitlab-odx.oracle.com/odx/functions funcy/go:dev go build -o functions-alpine - docker build --build-arg HTTP_PROXY -t treeder/functions:latest . + docker build --build-arg HTTP_PROXY -t funcy/functions:latest . docker-run: docker-build - docker run --rm --privileged -it -e NO_PROXY -e HTTP_PROXY -e LOG_LEVEL=debug -e "DB_URL=bolt:///app/data/bolt.db" -v ${CURDIR}/data:/app/data -p 8080:8080 treeder/functions + docker run --rm --privileged -it -e NO_PROXY -e HTTP_PROXY -e LOG_LEVEL=debug -e "DB_URL=bolt:///app/data/bolt.db" -v ${CURDIR}/data:/app/data -p 8080:8080 funcy/functions docker-test: docker run -ti --privileged --rm -e LOG_LEVEL=debug \ diff --git a/api/server/server.go b/api/server/server.go index 0ce248442..d2b622cb2 100644 --- a/api/server/server.go +++ b/api/server/server.go @@ -208,18 +208,17 @@ func (s *Server) startGears(ctx context.Context) { } const runHeader = ` - ____ __ - / __ \_________ ______/ /__ - / / / / ___/ __ / ___/ / _ \ - / /_/ / / / /_/ / /__/ / __/ - \_________ \__,_/\___/_/\____ - / ____/_ __ ___ _____/ /_( )___ ____ _____ - / /_ / / / / __ \/ ___/ __/ / __ \/ __ \/ ___/ - / __/ / /_/ / / / / /__/ /_/ / /_/ / / / (__ ) - /_/ \____/_/ /_/\___/\__/_/\____/_/ /_/____/ -` - - logrus.Infof(runHeader) + ____ __ + / __ \_________ ______/ /__ + / / / / ___/ __ / ___/ / _ \ + / /_/ / / / /_/ / /__/ / __/ + \_________ \__,_/\___/_/\____ + / ____/_ __ ___ _____/ /_( )___ ____ _____ + / /_ / / / / __ \/ ___/ __/ / __ \/ __ \/ ___/ + / __/ / /_/ / / / / /__/ /_/ / /_/ / / / (__ ) + /_/ \____/_/ /_/\___/\__/_/\____/_/ /_/____/ + ` + fmt.Println(runHeader) logrus.Infof("Serving Functions API on address `%s`", listen) svr := &supervisor.Supervisor{ diff --git a/fn/Makefile b/fn/Makefile index 6abd33734..ad8b5e512 100644 --- a/fn/Makefile +++ b/fn/Makefile @@ -20,7 +20,3 @@ release: GOOS=darwin go build -o fn_mac GOOS=windows go build -o fn.exe docker run --rm -v ${PWD}:/go/src/gitlab-odx.oracle.com/odx/functions/fn -w /go/src/gitlab-odx.oracle.com/odx/functions/fn funcy/go:dev go build -o fn_alpine - -# install locally -install: build - sudo mv fn /usr/local/bin/ diff --git a/fn/start.go b/fn/start.go index 4fb157d5e..f53404c1e 100644 --- a/fn/start.go +++ b/fn/start.go @@ -30,7 +30,8 @@ func start(c *cli.Context) error { if c.String("log-level") != "" { denvs = append(denvs, "GIN_MODE="+c.String("log-level")) } - // docker run --rm -it --name functions -v ${PWD}/data:/app/data -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 treeder/functions + // Socket mount: docker run --rm -it --name functions -v ${PWD}/data:/app/data -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 funcy/functions + // OR dind: docker run --rm -it --name functions -v ${PWD}/data:/app/data --privileged -p 8080:8080 funcy/functions wd, err := os.Getwd() if err != nil { logrus.WithError(err).Fatalln("Getwd failed") diff --git a/images/dind/Dockerfile b/images/dind/Dockerfile index b5e4db4f1..ca07e2b5e 100644 --- a/images/dind/Dockerfile +++ b/images/dind/Dockerfile @@ -1,11 +1,13 @@ -FROM docker:1.13.1-dind +FROM docker:edge-dind -RUN apk update && apk upgrade && apk add --no-cache ca-certificates +RUN apk add --no-cache ca-certificates -COPY entrypoint.sh /usr/local/bin/ -COPY dind.sh /usr/local/bin/ +# cleanup warning: https://github.com/docker-library/docker/issues/55 +RUN addgroup -g 2999 docker -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +COPY preentry.sh /usr/local/bin/ -# USAGE: Add a CMD to your own Dockerfile to use this (NOT an ENTRYPOINT, so that this is called) +ENTRYPOINT ["preentry.sh"] + +# USAGE: Add a CMD to your own Dockerfile to use this (NOT an ENTRYPOINT), eg: # CMD ["./runner"] diff --git a/images/dind/README.md b/images/dind/README.md index 227bacbb5..a264cd8e1 100644 --- a/images/dind/README.md +++ b/images/dind/README.md @@ -1,2 +1,4 @@ -This is the base image for all Titan's docker-in-docker images. +This is the base image for all docker-in-docker images. +The difference between this and the official `docker` images are that this will choose the best +filesystem automatically. The official ones use `vfs` (bad) by default unless you pass in a flag. diff --git a/images/dind/VERSION b/images/dind/VERSION index 8294c1843..7693c96bf 100644 --- a/images/dind/VERSION +++ b/images/dind/VERSION @@ -1 +1 @@ -0.1.2 \ No newline at end of file +0.1.3 \ No newline at end of file diff --git a/images/dind/build.sh b/images/dind/build.sh index d15958d29..bbbe4ce4f 100755 --- a/images/dind/build.sh +++ b/images/dind/build.sh @@ -1,3 +1,3 @@ set -ex -docker build -t treeder/dind:latest . +docker build --build-arg HTTP_PROXY -t funcy/dind:latest . diff --git a/images/dind/dind.sh b/images/dind/dind.sh deleted file mode 100755 index db3a15b9f..000000000 --- a/images/dind/dind.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -set -ex -# modified from: https://github.com/docker-library/docker/blob/866c3fbd87e8eeed524fdf19ba2d63288ad49cd2/1.11/dind/dockerd-entrypoint.sh -# this will run either overlay or aufs as the docker fs driver, if the OS has both, overlay is preferred. -# rewrite overlay to use overlay2 (docker 1.12, linux >=4.x required), see https://docs.docker.com/engine/userguide/storagedriver/selectadriver/#overlay-vs-overlay2 - -fsdriver=$(grep -Eh -w -m1 "overlay|aufs" /proc/filesystems | cut -f2) - -if [ $fsdriver == "overlay" ]; then - fsdriver="overlay2" -fi - -cmd="dockerd \ - --host=unix:///var/run/docker.sock \ - --host=tcp://0.0.0.0:2375 \ - --storage-driver=$fsdriver" - -# nanny and restart on crashes -until eval $cmd; do - echo "Docker crashed with exit code $?. Respawning.." >&2 - # if we just restart it won't work, so start it (it wedges up) and - # then kill the wedgie and restart it again and ta da... yea, seriously - pidfile=/var/run/docker/libcontainerd/docker-containerd.pid - kill -9 $(cat $pidfile) - rm $pidfile - sleep 1 -done diff --git a/images/dind/entrypoint.sh b/images/dind/entrypoint.sh deleted file mode 100755 index b05bbe475..000000000 --- a/images/dind/entrypoint.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -set -ex - -/usr/local/bin/dind.sh & - -# wait for daemon to initialize -sleep 3 - -exec "$@" diff --git a/images/dind/preentry.sh b/images/dind/preentry.sh new file mode 100755 index 000000000..64d60d19e --- /dev/null +++ b/images/dind/preentry.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -e + +fsdriver=$(grep -Eh -w -m1 "overlay|aufs" /proc/filesystems | cut -f2) +if [ $fsdriver == "overlay" ]; then + fsdriver="overlay2" +fi + +dockerd-entrypoint.sh --storage-driver=$fsdriver & + +# give docker a few seconds +sleep 3 + +exec "$@" diff --git a/images/dind/release.sh b/images/dind/release.sh index 8812e7f0c..14ceaed0a 100755 --- a/images/dind/release.sh +++ b/images/dind/release.sh @@ -6,7 +6,7 @@ docker run --rm -v "$PWD":/app treeder/bump patch version=`cat VERSION` echo "version $version" -docker tag treeder/dind:latest treeder/dind:$version +docker tag funcy/dind:latest funcy/dind:$version -docker push treeder/dind:latest -docker push treeder/dind:$version +docker push funcy/dind:latest +docker push funcy/dind:$version diff --git a/release.sh b/release.sh index 04b6a5e4e..9a87d0f0f 100755 --- a/release.sh +++ b/release.sh @@ -1,7 +1,7 @@ #!/bin/bash set -ex -user="treeder" +user="funcy" service="functions" tag="latest" @@ -34,11 +34,10 @@ git tag -f -a "$version" -m "version $version" git push git push origin $version -# TODO: Where to push these? # Finally tag and push docker images -# docker tag $user/$service:$tag $user/$service:$version -# docker push $user/$service:$version -# docker push $user/$service:$tag +docker tag $user/$service:$tag $user/$service:$version +docker push $user/$service:$version +docker push $user/$service:$tag cd fn ./release.sh $version