-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
28 lines (21 loc) · 1 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
FROM haproxy:1.7.2
MAINTAINER Esen Sagynov <kadishmal@gmail.com>
# `socat` is necessary for dumping the socket information
# to a temporary file before reloading the HAProxy.
RUN apt-get update -y && apt-get install -y socat
ENV HAPROXY_USER haproxy
# Create a system group and user to be used by HAProxy.
# Also need to create a directory for HAProxy to be able to `chroot`.
# This is a security measurement.
# Refer to http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#chroot.
RUN groupadd --system ${HAPROXY_USER} && \
useradd --system --gid ${HAPROXY_USER} ${HAPROXY_USER} && \
mkdir --parents /var/lib/${HAPROXY_USER} && \
chown -R ${HAPROXY_USER}:${HAPROXY_USER} /var/lib/${HAPROXY_USER}
COPY config/haproxy.cfg /usr/local/etc/haproxy/
# Now copy the configuration files for `rsyslog` logging service.
COPY config/rsyslog.conf /etc/rsyslog.conf
COPY config/haproxy-rsyslog.conf /etc/rsyslog.d/haproxy.conf
# Create a directory for admin socket used for stats.
RUN mkdir /run/haproxy/
EXPOSE 80