Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-stage docker build. #229

Merged
merged 7 commits into from
May 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,6 +38,7 @@ pipeline:

publish_latest:
image: plugins/docker
pull: true
repo: ${DRONE_REPO}
tags: [ 'latest' ]
secrets: [ docker_username, docker_password ]
Expand All @@ -50,6 +49,7 @@ pipeline:

publish_tag:
image: plugins/docker
pull: true
repo: ${DRONE_REPO}
tags: [ '${DRONE_TAG}' ]
secrets: [ docker_username, docker_password ]
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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),)
Expand Down