diff --git a/Dockerfile b/Dockerfile index cbdd5e8..50d32ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,28 @@ -FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime +FROM pytorch/pytorch:2.8.0-cuda12.6-cudnn9-runtime ARG DEBIAN_FRONTEND=noninteractive ENV CUDA_HOME=/usr/local/cuda \ - TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6+PTX" \ - SETUPTOOLS_USE_DISTUTILS=stdlib + TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6+PTX" -RUN conda update conda -y +# RUN conda update conda -y -# Install libraries in the brand new image. -RUN apt-get -y update && apt-get install -y --no-install-recommends \ - wget \ - build-essential \ - git \ - python3-opencv \ - ca-certificates && \ - rm -rf /var/lib/apt/lists/* +RUN apt -y update && apt install tesseract-ocr -y +RUN apt-get -y update && apt-get install libgl1 poppler-utils -y --no-install-recommends # Set the working directory for all the subsequent Dockerfile instructions. -WORKDIR /opt/program - -RUN git clone https://github.com/IDEA-Research/GroundingDINO.git +WORKDIR /app RUN mkdir weights ; cd weights ; wget -q https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth ; cd .. -RUN conda install -c "nvidia/label/cuda-12.1.1" cuda -y -ENV CUDA_HOME=$CONDA_PREFIX +COPY app.py /app/ +COPY pdf_converter.py /app/ +COPY uv.lock /app/ +COPY setup.py /app/ +ADD groundingdino/ /app/groundingdino/ +COPY pyproject.toml /app/ -ENV PATH=/usr/local/cuda/bin:$PATH +# RUN cd GroundingDINO/ && python -m pip install . +RUN pip install --no-cache-dir uv && uv sync --no-cache +RUN /app/.venv/bin/python -m pip install -e . -RUN cd GroundingDINO/ && python -m pip install . - -COPY docker_test.py docker_test.py - -CMD [ "python", "docker_test.py" ] \ No newline at end of file +CMD [ "/app/.venv/bin/python", "app.py" ] diff --git a/setup.py b/setup.py index 72c0719..71b0b63 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ def install_torch(): # Call the function to ensure torch is installed # install_torch() sys.path.insert( - 0, "/home/nguyendc/cuong-dev/GroundingDINO/.venv/lib/python3.13/site-packages" + 0, f"{__file__}/.venv/lib/python3.13/site-packages" ) import torch