File size: 1,160 Bytes
99f5777 ca26ae2 963b33c ba60a03 3f84c0a 974a821 ca26ae2 716770e 974a821 99f5777 974a821 5e4985f ca26ae2 5e4985f 0ecb388 36389f5 963b33c c84ad76 716770e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# Use NVIDIA CUDA image as the parent image
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
# Set the working directory inside the container
WORKDIR /app
# Create a non-root user
RUN useradd -m appuser
# Install system dependencies
RUN apt-get update && apt-get install -y git libsndfile1-dev tesseract-ocr espeak-ng python3 python3-pip ffmpeg
# Copy the requirements file into the container at /app
COPY ./requirements.txt /app/
# Grant necessary permissions to the non-root user
RUN chown -R appuser /app
# Switch to the non-root user
USER appuser
# Install Python dependencies and add necessary directories to PATH
RUN python3 -m pip install --user --no-cache-dir --upgrade pip && \
python3 -m pip install --user --no-cache-dir -r requirements.txt uvicorn
# Add necessary directories to PATH
ENV PATH="/home/appuser/.local/bin:${PATH}"
# Copy the current directory contents into the container at /app
COPY . /app/
# Create a writable cache directory inside the /app directory
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
# Specify the command to run your application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|