1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-13 01:02:42 +08:00

update docker build scripts

This commit is contained in:
bingohuang 2017-05-25 10:51:38 +08:00
parent 474ae465cc
commit a82d70724b
6 changed files with 50 additions and 6 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@ play-with-docker
node_modules
.idea
docker-labs*

View File

@ -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

15
Dockerfile.build Normal file
View File

@ -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

View File

@ -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

8
docker-build.sh Executable file
View File

@ -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

19
docker-start.sh Normal file
View File

@ -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