FROM python:3.11-alpine3.19

ENV PORT=8000
ENV STATIC_DIR=/public/static
EXPOSE 8000

RUN addgroup --gid 19143 --system ljg && \
    adduser --disabled-password --home /app --in-group ljg --system --uid 19143 ljg && \
    mkdir /public && \
    chown -R 19143:19143 /public

RUN pip --no-cache-dir install gunicorn

COPY scripts/entrypoint.sh /
COPY LICENSE pyproject.toml /app/
COPY ljg/ /app/ljg/

RUN pip --no-cache-dir install -e '/app[postgres]'

USER ljg

ENTRYPOINT ["/entrypoint.sh"]
