-
Notifications
You must be signed in to change notification settings - Fork 20
/
Dockerfile
32 lines (26 loc) · 730 Bytes
/
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
FROM python:3.9.9-alpine3.14
ENV LDAP_ENDPOINT=""
ENV LDAP_MANAGER_DN_USERNAME=""
ENV LDAP_MANAGER_PASSWORD=""
ENV LDAP_SEARCH_BASE=""
ENV LDAP_SEARCH_FILTER=""
ENV FLASK_SECRET_KEY="CHANGE_ME!"
ENV PYTHONUNBUFFERED=0
ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1
RUN apk --no-cache add build-base openldap-dev libffi-dev
COPY files/requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt --no-cache-dir
# Run as non-root
ENV USER aldap
ENV UID 10001
ENV GROUP aldap
ENV GID 10001
ENV HOME /home/$USER
RUN addgroup -g $GID -S $GROUP && adduser -u $UID -S $USER -G $GROUP
# Python code
COPY files/* $HOME/
RUN chown -R $USER:$GROUP $HOME
EXPOSE 9000
USER $UID:$GID
WORKDIR $HOME
CMD ["python3", "-u", "main.py"]