diff --git a/.drone.yml b/.drone.yml index 8f3447f..085af97 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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 ] diff --git a/Dockerfile b/Dockerfile index 0889f97..0b9fc9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/Makefile b/Makefile index 85a15e2..4e32e92 100644 --- a/Makefile +++ b/Makefile @@ -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),)