Support multi-stage docker build. (#229)

* support multi-stage docker image.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update docker image

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* test docker image.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* test docker image.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix image name

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update tag

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update drone config.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-05-15 23:29:49 +08:00 committed by GitHub
parent 2a6bd3a311
commit 96b5fb4921
3 changed files with 10 additions and 4 deletions

View File

@ -23,8 +23,6 @@ pipeline:
- coverage all
# send coverage report
- make coverage
# build binary for docker image
- make docker_build
release:
image: appleboy/golang-testing
@ -40,6 +38,7 @@ pipeline:
publish_latest:
image: plugins/docker
pull: true
repo: ${DRONE_REPO}
tags: [ 'latest' ]
secrets: [ docker_username, docker_password ]
@ -50,6 +49,7 @@ pipeline:
publish_tag:
image: plugins/docker
pull: true
repo: ${DRONE_REPO}
tags: [ '${DRONE_TAG}' ]
secrets: [ docker_username, docker_password ]

View File

@ -1,8 +1,14 @@
# build stage
FROM appleboy/golang-testing AS build-env
ADD . /go/src/github.com/appleboy/gorush
RUN cd /go/src/github.com/appleboy/gorush && make docker_build
# final stage
FROM centurylink/ca-certs
EXPOSE 8088
ADD config/config.yml /
ADD bin/gorush /
COPY --from=build-env /go/src/github.com/appleboy/gorush/bin/gorush /
ENTRYPOINT ["/gorush"]
CMD ["-c", "config.yml"]

View File

@ -134,7 +134,7 @@ docker_build:
docker_image:
docker build -t $(DEPLOY_ACCOUNT)/$(DEPLOY_IMAGE) -f Dockerfile .
docker_release: docker_build docker_image
docker_release: docker_image
docker_deploy:
ifeq ($(tag),)