FROM python:3.15.2-slim@sha256:c4158543ecb725b99e57d129dfd43d761d4c43e4577b5e23326aabb223cf7f4e

RUN groupadd -g 1000 saku && \
    useradd -m -d /saku -s /bin/bash -u 1000 -g 1000 saku

WORKDIR /saku
ENV PATH=/saku/.local/bin:$PATH

USER saku:saku
COPY Pipfile* ./
RUN python -m pip install pipenv && \
    pipenv install && \
    rm -Rf .cache

USER root:root
COPY docker/entrypoint.sh /
RUN chmod 755 /entrypoint.sh && \
  chown -R root:root /saku && \
  chmod 755 /saku
COPY file file
COPY shingetsu shingetsu
COPY template template
COPY www www
COPY saku.py .
COPY docker/saku.ini file
RUN python -m compileall shingetsu

EXPOSE 8000
ENTRYPOINT ["/entrypoint.sh"]
