-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build image using multi-stage builds (#72)
* chore: build image using multi-stage builds * chore: run tests during image build
- Loading branch information
1 parent
bdce197
commit ce6ce5d
Showing
5 changed files
with
37 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
FROM registry.opensource.zalan.do/stups/alpine:UPSTREAM | ||
MAINTAINER Team Teapot @ Zalando SE <[email protected]> | ||
# builder image | ||
FROM golang:1.8 as builder | ||
|
||
RUN go get github.com/Masterminds/glide | ||
WORKDIR /go/src/github.com/zalando-incubator/kube-ingress-aws-controller | ||
COPY . . | ||
RUN glide install --strip-vendor | ||
RUN make test | ||
RUN make build.linux | ||
|
||
# add scm-source | ||
ADD scm-source.json / | ||
# final image | ||
FROM registry.opensource.zalan.do/stups/alpine:latest | ||
MAINTAINER Team Teapot @ Zalando SE <[email protected]> | ||
|
||
# add binary | ||
ADD build/linux/kube-aws-ingress-controller / | ||
COPY --from=builder /go/src/github.com/zalando-incubator/kube-ingress-aws-controller/build/linux/kube-ingress-aws-controller \ | ||
/bin/kube-ingress-aws-controller | ||
|
||
ENTRYPOINT ["/kube-aws-ingress-controller"] | ||
ENTRYPOINT ["/bin/kube-ingress-aws-controller"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,18 @@ | ||
build_steps: | ||
- desc: 'Install required build software' | ||
cmd: | | ||
apt-get update | ||
apt-get install -y make git apt-transport-https ca-certificates \ | ||
curl software-properties-common python-software-properties | ||
- desc: 'Install go' | ||
cmd: | | ||
add-apt-repository -y ppa:longsleep/golang-backports | ||
apt-get update | ||
apt-get install -y golang-go | ||
- desc: 'Install Docker' | ||
cmd: | | ||
curl -sSL https://get.docker.com/ | sh | ||
- desc: 'Symlink sources into the GOPATH' | ||
cmd: | | ||
export GOPATH=$HOME/go | ||
export PKG_BASE_PATH=$GOPATH/src/github.com/zalando-incubator | ||
mkdir -p $PKG_BASE_PATH | ||
ln -s $(pwd) $PKG_BASE_PATH/kube-ingress-aws-controller | ||
- desc: 'Build & push docker image' | ||
cmd: | | ||
export PATH=$PATH:$HOME/go/bin | ||
IS_PR_BUILD=${CDP_PULL_REQUEST_NUMBER+"true"} | ||
if [[ ${CDP_TARGET_BRANCH} == "master" && ${IS_PR_BUILD} != "true" ]] | ||
then | ||
make build.push | ||
fi | ||
- desc: Install docker | ||
cmd: | | ||
apt-get update | ||
apt-get install -y apt-transport-https ca-certificates curl software-properties-common | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge" | ||
apt-get update | ||
apt-get install -y docker-ce | ||
- desc: Build and push docker image | ||
cmd: | | ||
image=registry-write.opensource.zalan.do/teapot/kube-ingress-aws-controller:${CDP_BUILD_VERSION} | ||
docker build --tag $image . | ||
IS_PR_BUILD=${CDP_PULL_REQUEST_NUMBER+"true"} | ||
if [[ ${CDP_TARGET_BRANCH} == "master" && ${IS_PR_BUILD} != "true" ]] | ||
then | ||
docker push $image | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters