pseudotheos's picture
Update Dockerfile
ca26ae2
raw
history blame
1.16 kB
# 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"]