-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (41 loc) · 1.28 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
FROM debian:bookworm-slim AS base
ARG DEBIAN_FRONTEND noninteractive
ENV VIRTUAL_ENV="/opt/ldap_auth_verify_venv"
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
ENV GUNICORN_PORT=8000
ENV GUNICORN_WORKERS=2
RUN set -eux; \
groupadd --system --gid 101 user; \
useradd --system --gid user --no-create-home --shell /bin/false --uid 101 user
RUN set -eux; \
apt-get update; \
apt-get -y dist-upgrade; \
apt-get -y install --no-install-recommends \
python3 \
libldap-2.5-0 \
python3-venv; \
apt-get clean all; \
rm -rf /var/lib/apt/lists/*
FROM base AS builder
RUN set -eux; \
apt-get update; \
apt-get -y install --no-install-recommends \
build-essential \
python3-pip \
python3-venv \
python3-dev \
libldap-dev \
libsasl2-dev; \
apt-get clean all; \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt /opt/requirements.txt
RUN set -eux; \
python3.11 -m venv "${VIRTUAL_ENV}"; \
pip install -r /opt/requirements.txt
FROM base AS final
COPY --from=builder /opt/ldap_auth_verify_venv /opt/ldap_auth_verify_venv
COPY LDAPAuthVerify.py /opt/ldap_auth_verify/LDAPAuthVerify.py
USER user
EXPOSE ${GUNICORN_PORT}
WORKDIR /opt/ldap_auth_verify
CMD gunicorn LDAPAuthVerify:app -w ${GUNICORN_WORKERS} -b 0.0.0.0:${GUNICORN_PORT}