-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: build image using multi-stage builds (#276)
- Loading branch information
Showing
3 changed files
with
31 additions
and
8 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 |
---|---|---|
|
@@ -12,10 +12,18 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM alpine:3.5 | ||
# builder image | ||
FROM golang:1.8 as builder | ||
|
||
RUN apk --update --no-cache add ca-certificates | ||
WORKDIR /go/src/github.com/kubernetes-incubator/external-dns | ||
COPY . . | ||
RUN make test | ||
RUN make build | ||
|
||
COPY build/linux-amd64/external-dns /external-dns | ||
# final image | ||
FROM registry.opensource.zalan.do/stups/alpine:latest | ||
MAINTAINER Team Teapot @ Zalando SE <[email protected]> | ||
|
||
ENTRYPOINT ["/external-dns"] | ||
COPY --from=builder /go/src/github.com/kubernetes-incubator/external-dns/build/external-dns /bin/external-dns | ||
|
||
ENTRYPOINT ["/bin/external-dns"] |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
build_steps: | ||
- 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) stable" | ||
apt-get update | ||
apt-get install -y docker-ce | ||
- desc: Build and push docker image | ||
cmd: | | ||
image=registry-write.opensource.zalan.do/teapot/external-dns:$(git describe --always --dirty --tags) | ||
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 |