ocr_api / Dockerfile
Genzo1010's picture
Update Dockerfile
0b86be7 verified
raw
history blame
987 Bytes
# Use Python 3.10 for compatibility with newer packages
FROM python:3.10
RUN useradd admin
USER admin
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set up a working directory
WORKDIR $HOME/app
COPY --chown=user ./ $HOME/app
# Expose port 80
EXPOSE 80
# Install OpenCV and poppler-utils dependencies
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 libsm6 poppler-utils
# Copy just the requirements file into the working directory
COPY ./requirements.txt /code/requirements.txt
# Install dependencies from the requirements file
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Install PyTorch or TensorFlow
RUN pip install torch torchvision
# Set environment variable to indicate PyTorch usage
ENV USE_TORCH=1
# Copy the rest of the application code into the working directory
COPY . .
# Set the entry point to run the FastAPI app with uvicorn
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]