mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-07-14 01:57:32 +08:00
update docker build scripts
This commit is contained in:
parent
474ae465cc
commit
a82d70724b
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@ play-with-docker
|
|||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
docker-labs*
|
||||||
|
@ -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 the runtime dockerfile into the context as Dockerfile
|
||||||
COPY Dockerfile.run /go/bin/Dockerfile
|
COPY Dockerfile.run /go/bin/Dockerfile
|
||||||
COPY ./www /go/bin/www
|
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 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
|
# Set the workdir to be /go/bin which is where the binaries are built
|
||||||
WORKDIR /go/bin
|
WORKDIR /go/bin
|
||||||
|
15
Dockerfile.build
Normal file
15
Dockerfile.build
Normal 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
|
@ -3,10 +3,10 @@ FROM alpine
|
|||||||
RUN apk --update add ca-certificates
|
RUN apk --update add ca-certificates
|
||||||
RUN mkdir -p /app/pwd
|
RUN mkdir -p /app/pwd
|
||||||
|
|
||||||
ADD play-with-docker /app/play-with-docker
|
ADD docker-labs /app/docker-labs
|
||||||
COPY ./www /app/www
|
COPY ./www /app/www
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
CMD ["./play-with-docker"]
|
CMD ["./docker-labs"]
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
8
docker-build.sh
Executable file
8
docker-build.sh
Executable 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
19
docker-start.sh
Normal 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
|
Loading…
x
Reference in New Issue
Block a user