feat: add multiple stage build for docker.

This commit is contained in:
Bo-Yi Wu 2017-08-15 14:20:15 +08:00
parent 5fbd22f265
commit 7ac95ea9e8
2 changed files with 5 additions and 3 deletions

View File

@ -25,8 +25,6 @@ pipeline:
- coverage all - coverage all
- make coverage - make coverage
- make build - make build
# build binary for docker image
- make static_build
when: when:
event: [ push, tag, pull_request ] event: [ push, tag, pull_request ]

View File

@ -1,3 +1,7 @@
FROM appleboy/golang-testing AS build-env
ADD . /go/src/github.com/appleboy/drone-ssh
RUN cd /go/src/github.com/appleboy/drone-ssh && make static_build
FROM alpine:3.4 FROM alpine:3.4
RUN apk update && \ RUN apk update && \
@ -6,5 +10,5 @@ RUN apk update && \
openssh-client && \ openssh-client && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
ADD drone-ssh /bin/ COPY --from=build-env /go/src/github.com/appleboy/drone-ssh/drone-ssh /bin
ENTRYPOINT ["/bin/drone-ssh"] ENTRYPOINT ["/bin/drone-ssh"]