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:
parent
2a6bd3a311
commit
96b5fb4921
|
@ -23,8 +23,6 @@ pipeline:
|
||||||
- coverage all
|
- coverage all
|
||||||
# send coverage report
|
# send coverage report
|
||||||
- make coverage
|
- make coverage
|
||||||
# build binary for docker image
|
|
||||||
- make docker_build
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
image: appleboy/golang-testing
|
image: appleboy/golang-testing
|
||||||
|
@ -40,6 +38,7 @@ pipeline:
|
||||||
|
|
||||||
publish_latest:
|
publish_latest:
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
|
pull: true
|
||||||
repo: ${DRONE_REPO}
|
repo: ${DRONE_REPO}
|
||||||
tags: [ 'latest' ]
|
tags: [ 'latest' ]
|
||||||
secrets: [ docker_username, docker_password ]
|
secrets: [ docker_username, docker_password ]
|
||||||
|
@ -50,6 +49,7 @@ pipeline:
|
||||||
|
|
||||||
publish_tag:
|
publish_tag:
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
|
pull: true
|
||||||
repo: ${DRONE_REPO}
|
repo: ${DRONE_REPO}
|
||||||
tags: [ '${DRONE_TAG}' ]
|
tags: [ '${DRONE_TAG}' ]
|
||||||
secrets: [ docker_username, docker_password ]
|
secrets: [ docker_username, docker_password ]
|
||||||
|
|
|
@ -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
|
FROM centurylink/ca-certs
|
||||||
EXPOSE 8088
|
EXPOSE 8088
|
||||||
|
|
||||||
ADD config/config.yml /
|
ADD config/config.yml /
|
||||||
ADD bin/gorush /
|
COPY --from=build-env /go/src/github.com/appleboy/gorush/bin/gorush /
|
||||||
|
|
||||||
ENTRYPOINT ["/gorush"]
|
ENTRYPOINT ["/gorush"]
|
||||||
CMD ["-c", "config.yml"]
|
CMD ["-c", "config.yml"]
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -134,7 +134,7 @@ docker_build:
|
||||||
docker_image:
|
docker_image:
|
||||||
docker build -t $(DEPLOY_ACCOUNT)/$(DEPLOY_IMAGE) -f Dockerfile .
|
docker build -t $(DEPLOY_ACCOUNT)/$(DEPLOY_IMAGE) -f Dockerfile .
|
||||||
|
|
||||||
docker_release: docker_build docker_image
|
docker_release: docker_image
|
||||||
|
|
||||||
docker_deploy:
|
docker_deploy:
|
||||||
ifeq ($(tag),)
|
ifeq ($(tag),)
|
||||||
|
|
Loading…
Reference in New Issue