-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
37 lines (28 loc) · 1.22 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
FROM alpine:3.13
ARG CONSUL_USERID
ENV CONSUL_VERSION=1.9.4 \
CONSUL_USERNAME="consul" \
CONSUL_USERID=${CONSUL_USERID:-1050}
# hadolint ignore=DL3018
RUN apk --update --no-cache add tini curl bash libcap python3 net-tools ca-certificates && \
rm -rf /var/cache/apk/* && \
mkdir /consul
COPY ./src/bin/start-consul.sh /bin/start-consul.sh
COPY ./src/etc/config.json /consul/config.json
RUN adduser -D -u ${CONSUL_USERID} ${CONSUL_USERNAME} && \
curl -sSLo /tmp/consul.zip https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip && \
unzip -d /bin /tmp/consul.zip && \
rm -f /tmp/consul.zip && \
mkdir -p /consul/data /consul/ui /consul/config && \
chown -R consul /consul && \
chmod 644 /consul/config.json && \
setcap cap_ipc_lock=+ep "$(readlink -f /bin/consul)" && \
setcap "cap_net_bind_service=+ep" /bin/consul && \
chmod +x /bin/start-consul.sh
USER $CONSUL_USERNAME
EXPOSE 8300 8301 8301/udp 8302 8302/udp 8400 8500 53 53/udp
VOLUME ["/consul/data", "/consul/config"]
HEALTHCHECK --interval=10s --timeout=5s CMD curl -sf http://localhost:8500/ || exit 1
ENV SHELL /bin/bash
ENTRYPOINT ["/sbin/tini", "--", "/bin/start-consul.sh"]
CMD []