diff --git a/.gitignore b/.gitignore index 18b28a2..786a1af 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ play-with-docker node_modules .idea + +docker-labs* diff --git a/Dockerfile b/Dockerfile index 1183ed9..e9296c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,16 @@ -FROM golang:1.7 +FROM hub.c.163.com/library/golang:1.8.2 # Copy the runtime dockerfile into the context as Dockerfile COPY Dockerfile.run /go/bin/Dockerfile COPY ./www /go/bin/www -COPY . /go/src/github.com/play-with-docker/play-with-docker +COPY . /go/src/github.com/bingohuang/docker-labs -WORKDIR /go/src/github.com/play-with-docker/play-with-docker +WORKDIR /go/src/github.com/bingohuang/docker-labs RUN go get -v -d ./... -RUN CGO_ENABLED=0 go build -a -installsuffix nocgo -o /go/bin/play-with-docker . +RUN CGO_ENABLED=0 go build -a -installsuffix nocgo -o /go/bin/docker-labs . # Set the workdir to be /go/bin which is where the binaries are built WORKDIR /go/bin diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..9280787 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,15 @@ +FROM alpine + +RUN apk --update add ca-certificates + +RUN mkdir -p /app/pwd + +COPY ./www /app/www + +ADD docker-labs_linux_amd64 /app/docker-labs + +WORKDIR /app + +CMD ["./docker-labs"] + +EXPOSE 3000 diff --git a/Dockerfile.run b/Dockerfile.run index bc5db60..c06ffd3 100644 --- a/Dockerfile.run +++ b/Dockerfile.run @@ -3,10 +3,10 @@ FROM alpine RUN apk --update add ca-certificates RUN mkdir -p /app/pwd -ADD play-with-docker /app/play-with-docker +ADD docker-labs /app/docker-labs COPY ./www /app/www WORKDIR /app -CMD ["./play-with-docker"] +CMD ["./docker-labs"] EXPOSE 3000 diff --git a/docker-build.sh b/docker-build.sh new file mode 100755 index 0000000..43b4d98 --- /dev/null +++ b/docker-build.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +version=":$1" +echo "version=$version" + +gox -osarch="linux/amd64" \ + && docker build -t hub.c.163.com/bingohuang/docker-labs$version -f Dockerfile-build . \ + && docker push hub.c.163.com/bingohuang/docker-labs$version diff --git a/docker-start.sh b/docker-start.sh new file mode 100644 index 0000000..94b7b6d --- /dev/null +++ b/docker-start.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +labs_version=$1 +echo "labs_version=$labs_version" + +dind_version=$2 +echo "dind_version=$dind_version" + +docker pull hub.c.163.com/bingohuang/docker-labs:$labs_version +docker pull hub.c.163.com/bingohuang/dind:$dind_version + +docker rm -f docker-labs +docker run -d \ +--publish=80:3000 \ +--volume /var/run/docker.sock:/var/run/docker.sock \ +-e GOOGLE_RECAPTCHA_DISABLED="true" \ +-e DIND_IMAGE="hub.c.163.com/bingohuang/dind:$dind_version" \ +-e EXPIRY="3h" +--name docker-labs hub.c.163.com/bingohuang/docker-labs:$labs_version