ocr_api / Dockerfile
Genzo1010's picture
Update Dockerfile
be7b5eb verified
raw
history blame
691 Bytes
# Use Python 3.10 for compatibility with newer packages
FROM python:3.10
RUN useradd user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set up a working directory
WORKDIR $HOME/app
COPY --chown=user ./ $HOME/app
# Install OpenCV and poppler-utils dependencies
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 libsm6 poppler-utils
# Install dependencies from the requirements file
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Install PyTorch or TensorFlow
RUN pip install torch torchvision
# Set environment variable to indicate PyTorch usage
ENV USE_TORCH=1
CMD fastapi run --reload --host=0.0.0.0 --port=7860