43 lines
1.7 KiB
Text
43 lines
1.7 KiB
Text
FROM qgis/qgis:3.40.2-bookworm
|
|
|
|
# Set environment variables for QGIS
|
|
ENV QGIS_PREFIX_PATH=/usr
|
|
ENV QT_QPA_PLATFORM=offscreen
|
|
ENV XDG_RUNTIME_DIR=/tmp/runtime-root
|
|
# Set environment variables
|
|
## Prevents Python from writing pyc files to disc (equivalent to python -B option)
|
|
ENV PYTHONDONTWRITEBYTECODE 1
|
|
## Prevents Python from buffering stdout and stderr (equivalent to python -u option)
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
RUN apt-get update && \
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -yqq nano sed curl git wget libldap2-dev libsasl2-dev locales && apt autoremove && apt clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set the locale
|
|
RUN sed -i '/fr_FR.UTF-8/s/^# //g' /etc/locale.gen && \
|
|
locale-gen
|
|
ENV LANG fr_FR.UTF-8
|
|
ENV LANGUAGE fr_FR:en
|
|
ENV LC_ALL fr_FR.UTF-8
|
|
|
|
#### DJANGO #######
|
|
WORKDIR /code
|
|
COPY . /code/
|
|
# Assuming somewhere on top there is already `python3-venv` installed
|
|
# via system package manager, e.g. `apt-get install -y python3-venv`
|
|
# Link local QGIS Python bindings and local python packages with Python virtual environment
|
|
RUN python3 -m venv --system-site-packages /opt/venv
|
|
ENV PATH="/opt/venv/bin:$PATH"
|
|
# Below you can continue using `pip install` as normal
|
|
RUN pip3 install --no-cache-dir -r requirements.txt
|
|
|
|
RUN echo 'alias python=python3' >> ~/.bashrc
|
|
# Clean all
|
|
RUN apt-get autoremove -y \
|
|
&& rm /etc/localtime \
|
|
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
|
|
&& dpkg-reconfigure -f noninteractive tzdata \
|
|
&& apt-get clean \
|
|
&& apt-get purge \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|