initial
This commit is contained in:
parent
36db8d7f6b
commit
1ee095d1af
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.env
|
78
Dockerfile
Normal file
78
Dockerfile
Normal file
@ -0,0 +1,78 @@
|
||||
FROM alpine:3 as builder
|
||||
|
||||
ARG HAPROXY_VERSION=
|
||||
ARG HAPROXY_REPO
|
||||
|
||||
RUN \
|
||||
apk update --no-cache && \
|
||||
apk add --no-cache --virtual \
|
||||
build-deps \
|
||||
ca-certificates \
|
||||
gcc \
|
||||
git \
|
||||
libc-dev \
|
||||
linux-headers \
|
||||
lua5.3-dev \
|
||||
make \
|
||||
openssl \
|
||||
openssl-dev \
|
||||
pcre2-dev \
|
||||
tar \
|
||||
zlib-dev \
|
||||
curl \
|
||||
shadow \
|
||||
&& \
|
||||
git config --global advice.detachedHead false
|
||||
|
||||
RUN \
|
||||
echo "selected repo: ${HAPROXY_REPO}" && \
|
||||
if [ -z "${HAPROXY_VERSION}" ]; then \
|
||||
HAPROXY_VERSION=$( \
|
||||
git ls-remote "${HAPROXY_REPO}" | \
|
||||
awk '$2 ~ /^refs\/tags\/v[0-9]+\.[0-9]+\.[0-9]+$/ { print substr($2,11) }' | sort -V | tail -n1 \
|
||||
) ; \
|
||||
fi && \
|
||||
echo "selected branch: ${HAPROXY_VERSION}" && \
|
||||
cd / && \
|
||||
git clone \
|
||||
--branch="${HAPROXY_VERSION}" \
|
||||
--depth=1 \
|
||||
"${HAPROXY_REPO}" \
|
||||
haproxy && \
|
||||
cd haproxy && \
|
||||
make \
|
||||
-j"$(nproc)" \
|
||||
TARGET=linux-musl \
|
||||
CPU=generic \
|
||||
USE_PCRE2=1 \
|
||||
USE_PCRE2_JIT=1 \
|
||||
USE_REGPARM=1 \
|
||||
USE_OPENSSL=1 \
|
||||
USE_ZLIB=1 \
|
||||
USE_TFO=1 \
|
||||
USE_LINUX_TPROXY=1 \
|
||||
USE_GETADDRINFO=1 \
|
||||
USE_LUA=1 \
|
||||
LUA_LIB=/usr/lib/lua5.3 \
|
||||
LUA_INC=/usr/include/lua5.3 \
|
||||
EXTRA_OBJS="contrib/prometheus-exporter/service-prometheus.o" \
|
||||
all
|
||||
|
||||
FROM alpine:3
|
||||
|
||||
ENV UID=1000
|
||||
ENV GID=1000
|
||||
|
||||
COPY --from=builder /haproxy/haproxy /haproxy
|
||||
|
||||
ENTRYPOINT \
|
||||
(\
|
||||
grep -qE '^haproxy:x:'"${UID}"':haproxy$' /etc/group || addgroup -g "${GID}" haproxy\
|
||||
) && \
|
||||
(\
|
||||
grep -qE '^haproxy:x:'"${UID}"':'"${GID}"':.*$' /etc/passwd || adduser -D -u "${UID}" -G haproxy haproxy \
|
||||
) && \
|
||||
chmod 700 /etc/haproxy && chown haproxy:haproxy /etc/haproxy
|
||||
|
||||
CMD su haproxy -c "/haproxy -f /haproxy"
|
||||
|
18
docker-compose.yaml
Normal file
18
docker-compose.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
version: '3'
|
||||
services:
|
||||
haproxy:
|
||||
build:
|
||||
context: ./
|
||||
args:
|
||||
- HAPROXY_REPO=${HAPROXY_REPO}
|
||||
container_name: haproxy
|
||||
image: haproxy:local
|
||||
logging:
|
||||
driver: journald
|
||||
options:
|
||||
tag: haproxy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 8443:8443
|
||||
volumes:
|
||||
- ${HAPROXY_CONFIG_FILE_PATH}:/etc/haproxy/haproxy.cfg:ro
|
Loading…
Reference in New Issue
Block a user