mother-tongue / Dockerfile
r3Vibe's picture
Update Dockerfile
fda84bd verified
raw
history blame contribute delete
No virus
1.08 kB
# Use the official Python image
FROM python:3.11
# Set the working directory inside the container
WORKDIR /code
# Install ffmpeg and other dependencies
RUN apt-get update && \
apt-get install -y ffmpeg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy the requirements file and install dependencies
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Create the Hugging Face cache directory, set permissions, and create a non-root user
RUN mkdir -p /.cache/huggingface/hub && \
chmod -R 777 /.cache/huggingface && \
useradd -m nonrootuser
# Set ownership of the .cache directory to the non-root user
RUN chown -R nonrootuser:nonrootuser /.cache/huggingface
# Copy the rest of the application code
COPY . .
# Change ownership of the application code to the non-root user
RUN chown -R nonrootuser:nonrootuser /code
# Switch to the non-root user
USER nonrootuser
# Specify the command to run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]