2023-11-18 21:23:56 +03:00
|
|
|
# Using a slim version for a smaller base image
|
2024-06-06 20:06:21 +03:00
|
|
|
FROM python:3.11.6-slim-bullseye
|
2023-11-18 21:23:56 +03:00
|
|
|
|
|
|
|
ARG DEV_MODE
|
|
|
|
ENV DEV_MODE=$DEV_MODE
|
|
|
|
|
|
|
|
# Install GEOS library, Rust, and other dependencies, then clean up
|
|
|
|
RUN apt-get clean && apt-get update && apt-get install -y \
|
|
|
|
libgeos-dev \
|
|
|
|
libcurl4-openssl-dev \
|
|
|
|
libssl-dev \
|
|
|
|
binutils \
|
|
|
|
curl \
|
|
|
|
git \
|
2024-01-26 02:56:46 +03:00
|
|
|
autoconf \
|
|
|
|
automake \
|
2024-02-17 03:28:27 +03:00
|
|
|
build-essential \
|
2024-01-26 02:56:46 +03:00
|
|
|
libtool \
|
|
|
|
python-dev \
|
2024-02-13 06:56:20 +03:00
|
|
|
build-essential \
|
|
|
|
# Additional dependencies for document handling
|
|
|
|
libmagic-dev \
|
|
|
|
poppler-utils \
|
|
|
|
tesseract-ocr \
|
|
|
|
libreoffice \
|
2024-02-17 03:28:27 +03:00
|
|
|
libpq-dev \
|
|
|
|
gcc \
|
2024-02-13 06:56:20 +03:00
|
|
|
pandoc && \
|
2023-11-18 21:23:56 +03:00
|
|
|
rm -rf /var/lib/apt/lists/* && apt-get clean
|
|
|
|
|
2024-06-26 10:58:55 +03:00
|
|
|
# TODO(@aminediro) : multistage build. Probably dont neet poetry once its built
|
|
|
|
# Install Poetry
|
|
|
|
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
|
|
|
|
cd /usr/local/bin && \
|
|
|
|
ln -s /opt/poetry/bin/poetry && \
|
|
|
|
poetry config virtualenvs.create false
|
|
|
|
|
2023-11-18 21:23:56 +03:00
|
|
|
# Add Rust binaries to the PATH
|
2024-06-26 10:58:55 +03:00
|
|
|
ENV PATH="/root/.cargo/bin:${PATH}" \
|
|
|
|
POETRY_CACHE_DIR=/tmp/poetry_cache \
|
|
|
|
PYTHONDONTWRITEBYTECODE=1
|
2023-11-18 21:23:56 +03:00
|
|
|
|
2024-06-26 10:58:55 +03:00
|
|
|
WORKDIR /code
|
2023-11-18 21:23:56 +03:00
|
|
|
|
2024-06-26 10:58:55 +03:00
|
|
|
# Copy pyproject and poetry
|
|
|
|
COPY ./pyproject.toml ./poetry.lock* /code/
|
2023-11-18 21:23:56 +03:00
|
|
|
|
2024-06-26 10:58:55 +03:00
|
|
|
# Run install
|
|
|
|
RUN poetry install --no-root && \
|
|
|
|
playwright install --with-deps && \
|
|
|
|
rm -rf $POETRY_CACHE_DIR
|
2023-11-18 21:23:56 +03:00
|
|
|
|
|
|
|
|
2024-06-26 10:58:55 +03:00
|
|
|
ENV PYTHONPATH=/code
|
2024-02-15 01:01:35 +03:00
|
|
|
|
2023-11-18 21:23:56 +03:00
|
|
|
EXPOSE 5050
|