FROM docker.io/library/python:3.10-slim-bullseye as wheels # hadolint ignore=DL3008,DL3015 RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ build-essential \ git \ libldap2-dev \ libsasl2-dev \ ; WORKDIR /wheels RUN python3 -m pip wheel https://github.com/python-ldap/python-ldap/archive/refs/tags/python-ldap-3.4.2.tar.gz # hadolint ignore=DL3059 RUN python3 -m pip wheel https://git.shore.co.il/nimrod/flask-simpleldap/-/archive/ldapi-support/flask-simpleldap-ldapi-support.tar.gz FROM docker.io/library/python:3.10-slim-bullseye # hadolint ignore=DL3008 RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ libldap-2.4-2 \ libsasl2-2 \ wget \ && \ rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/* COPY --from=wheels /wheels/*.whl /wheels/ # hadolint ignore=DL3042 RUN pip install /wheels/*.whl WORKDIR /app COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt COPY * ./ USER nobody EXPOSE 8080 ENV FORWARDED_ALLOW_IPS "*" HEALTHCHECK CMD wget --spider --quiet http://localhost:8080/ping --user-agent 'Docker Healthcheck' || exit 1 CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--log-file", "-", "--workers", "2", "app:app"]