-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
75 lines (66 loc) · 2.36 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FROM golang:1.13-alpine AS go
# install gotpl & confd
RUN set -x \
&& apk add --no-cache git \
&& export GOPATH=/usr/src/go \
&& go get github.com/tsg/gotpl \
&& go get github.com/kelseyhightower/confd \
&& apk del --no-cache git
FROM alpine:3.4 AS final
# install dependencies
RUN apk add --no-cache curl nodejs rsyslog supervisor \
&& npm install -g json2yaml merge-yaml js-yaml lodash.merge \
&& curl -L -o /usr/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 \
&& chmod +x /usr/bin/jq \
&& mkdir -p /etc/rsyslog.d /etc/haproxy /etc/confd /etc/lb /etc/supervisor /var/spool/rsyslog
ENV NODE_PATH /usr/lib/node_modules
# install haproxy
ENV HAPROXY_MAJOR 1.6
ENV HAPROXY_VERSION 1.6.7
ENV HAPROXY_MD5 a046ed63b00347bd367b983529dd541f
RUN set -x \
&& apk add --no-cache --virtual .build-deps \
curl \
gcc \
libc-dev \
linux-headers \
make \
openssl-dev \
pcre-dev \
zlib-dev \
&& curl -SL "http://www.haproxy.org/download/${HAPROXY_MAJOR}/src/haproxy-${HAPROXY_VERSION}.tar.gz" -o haproxy.tar.gz \
&& echo "${HAPROXY_MD5} haproxy.tar.gz" | md5sum -c \
&& mkdir -p /usr/src \
&& tar -xzf haproxy.tar.gz -C /usr/src \
&& mv "/usr/src/haproxy-$HAPROXY_VERSION" /usr/src/haproxy \
&& rm haproxy.tar.gz \
&& make -C /usr/src/haproxy \
TARGET=linux2628 \
USE_PCRE=1 PCREDIR= \
USE_OPENSSL=1 \
USE_ZLIB=1 \
all \
install-bin \
&& cp -R /usr/src/haproxy/examples/errorfiles /etc/haproxy/errors \
&& rm -rf /usr/src/haproxy \
&& runDeps="$( \
scanelf --needed --nobanner --recursive /usr/local \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --no-cache --virtual .haproxy-rundeps $runDeps \
&& apk del --no-cache .build-deps
# install gotpl & confd
COPY --from=go /usr/src/go/bin/gotpl /usr/bin/gotpl
COPY --from=go /usr/src/go/bin/confd /usr/bin/confd
ADD entries.tpl /etc/confd/templates/entries.tpl
ADD entries.toml /etc/confd/conf.d/entries.toml
ADD rsyslog.conf /etc/rsyslog.d/rsyslog.conf
ADD haproxy.cfg.tpl /etc/lb/haproxy.cfg.tpl
ADD supervisor.conf /etc/supervisor/supervisor.conf
VOLUME /etc/haproxy
COPY lb-* /usr/bin/
RUN chmod +x /usr/bin/lb-*
ENTRYPOINT /usr/bin/lb-bootstrap