From 7ea44feb776deda6472bc0cfc4af801a58c1c555 Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Fri, 6 Jul 2018 12:08:45 -0400 Subject: [PATCH] fix consul Signed-off-by: Jess Frazelle --- consul/Dockerfile | 60 +++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/consul/Dockerfile b/consul/Dockerfile index 7295732..fe68b5e 100644 --- a/consul/Dockerfile +++ b/consul/Dockerfile @@ -1,38 +1,42 @@ -FROM alpine:latest -LABEL maintainer "Jessie Frazelle " +FROM golang:latest as builder +MAINTAINER Jessica Frazelle ENV PATH /go/bin:/usr/local/go/bin:$PATH ENV GOPATH /go -#ENV GO15VENDOREXPERIMENT 1 -RUN apk --no-cache add \ - ca-certificates +RUN apt-get update && apt-get install -y \ + ca-certificates \ + gcc \ + git \ + make \ + ruby-dev \ + ruby \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* ENV CONSUL_VERSION v1.2.0 -RUN buildDeps=' \ - bash \ - go \ - git \ - gcc \ - g++ \ - libc-dev \ - libgcc \ - make \ - nodejs \ - ruby \ - ruby-dev \ - zip \ - ' \ - set -x \ - && apk --no-cache add --repository https://dl-3.alpinelinux.org/alpine/edge/community $buildDeps \ - && mkdir -p /go/src/github.com/hashicorp /etc/consul.d \ - && git clone --depth 1 --branch ${CONSUL_VERSION} https://github.com/hashicorp/consul /go/src/github.com/hashicorp/consul \ - && cd /go/src/github.com/hashicorp/consul \ - && XC_ARCH="amd64" XC_OS="linux" make bin \ - && apk del $buildDeps \ - && rm -rf /go \ - && echo "Build complete." +RUN go get github.com/hashicorp/consul +WORKDIR /go/src/github.com/hashicorp/consul + +RUN git checkout "${CONSUL_VERSION}" + +# Install deps for UI. +RUN gem install \ + bundler \ + --no-ri --no-rdoc + +RUN cd ui \ + && make dist + +RUN TERM=xterm XC_ARCH="amd64" XC_OS="linux" LD_FLAGS=" -extldflags -static" make tools static-assets bin \ + && mv bin/consul /usr/bin/consul + +FROM alpine:latest + +COPY --from=builder /usr/bin/consul /usr/bin/consul +COPY --from=builder /etc/ssl/certs/ /etc/ssl/certs ENTRYPOINT [ "consul" ] +CMD [ "--help" ]