2024-09-24 01:03:51 +00:00
FROM python:3.11.10-slim-bookworm
2024-08-02 11:05:02 +00:00
# last line is dependencies for weasyprint (for generating pdfs in lafede pilot) https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#debian-11
RUN apt update && \
apt-get install -y \
python3-xapian \
git \
sqlite3 \
jq \
2024-11-27 00:31:15 +00:00
time \
2024-11-27 14:06:41 +00:00
vim \
2024-08-02 11:05:02 +00:00
&& rm -rf /var/lib/apt/lists/*
2024-11-27 14:06:41 +00:00
# TODO I don't like this, but the whole ereuse-dpp works with user 1000 because of the volume mapping
# thanks https://stackoverflow.com/questions/70520205/docker-non-root-user-best-practices-for-python-images
RUN adduser --home /opt/devicehub-django -u 1000 app
2024-08-02 11:05:02 +00:00
WORKDIR /opt/devicehub-django
# reduce size (python specifics) -> src https://stackoverflow.com/questions/74616667/removing-pip-cache-after-installing-dependencies-in-docker-image
ENV PYTHONDONTWRITEBYTECODE = 1
# here document in dockerfile src https://stackoverflow.com/questions/40359282/launch-a-cat-command-unix-into-dockerfile
RUN cat > /etc/pip.conf <<END
[ install]
compile = no
[ global]
no-cache-dir = True
END
COPY ./requirements.txt /opt/devicehub-django
RUN pip install -r requirements.txt
2024-11-19 17:11:48 +00:00
# TODO hardcoded, is ignored in requirements.txt
RUN pip install -i https://test.pypi.org/simple/ ereuseapitest = = 0.0.14
2024-08-02 11:05:02 +00:00
# TODO Is there a better way?
# Set PYTHONPATH to include the directory with the xapian module
ENV PYTHONPATH = " ${ PYTHONPATH } :/usr/lib/python3/dist-packages "
COPY docker/devicehub-django.entrypoint.sh /
2024-11-27 08:28:39 +00:00
2024-11-27 14:06:41 +00:00
RUN chown -R app:app /opt/devicehub-django
2024-11-27 08:28:39 +00:00
2024-11-27 14:06:41 +00:00
USER app
2024-08-02 11:05:02 +00:00
ENTRYPOINT sh /devicehub-django.entrypoint.sh