Spaces:
Sleeping
Sleeping
ARG CUDA_IMAGE="12.1.1-devel-ubuntu22.04" | |
FROM nvidia/cuda:${CUDA_IMAGE} | |
RUN apt-get update && apt-get install -y \ | |
python3.10 python3-pip \ | |
tesseract-ocr \ | |
libtesseract-dev \ | |
libgl1-mesa-glx \ | |
poppler-utils \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set the working directory in the container | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y libgl1-mesa-glx | |
# Copy the dependencies file to the working directory | |
COPY requirements.txt . | |
# Install dependencies | |
RUN pip install --trusted-host pypi.python.org -r requirements.txt | |
# Copy the content of the local src directory to the working directory | |
COPY . . | |
# Create a user to run the application | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Set the working directory in the user's home directory | |
WORKDIR $HOME/app | |
COPY --chown=user . $HOME/app | |
# Expose the port number on which the Flask app will run | |
EXPOSE 7860 | |
# Define environment variable | |
ENV NAME World | |
# Command to run on container start | |
CMD [ "gunicorn", "--workers=1", "--keep-alive=100000000", "--threads=10", "-b", "0.0.0.0:7860", "librarymed.app_librarymed:app" ] |