# Acutis Gate — standalone image (auth + Gate only; see backend/app/gate_main.py)
FROM python:3.12-slim
WORKDIR /app
# Active Directory (on-prem edition): MIT Kerberos tools for the keytab, the
# GSSAPI SASL plugin for signed LDAP binds, Samba winbind so the DC can check
# NTLM answers (when an admin allows NTLM), and the build deps for python-gssapi
# and python-ldap (purged after the wheels are built). The domain join lives in
# /var/lib/samba: keep it on a volume (docker-compose.yml does).
COPY gate-appliance/requirements-ad.txt gate-appliance/requirements-ad.txt
RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
      krb5-user libsasl2-modules-gssapi-mit libgssapi-krb5-2 libldap2 libsasl2-2 \
      winbind samba-common-bin \
      gcc libc6-dev libkrb5-dev libldap2-dev libsasl2-dev \
 && pip install --no-cache-dir -r gate-appliance/requirements-ad.txt \
 && apt-get purge -y gcc libc6-dev libkrb5-dev libldap2-dev libsasl2-dev \
 && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* /etc/krb5.conf
COPY backend/requirements.txt backend/requirements.txt
RUN pip install --no-cache-dir -r backend/requirements.txt
COPY backend ./backend
COPY demo ./demo
ENV GATE_RUN_DIR=/run/acutis-gate
EXPOSE 8010
CMD ["uvicorn", "backend.app.gate_main:app", "--host", "0.0.0.0", "--port", "8010"]
