AudioDeNoiseAPI / Dockerfile
ArnavGhost's picture
Update Dockerfile
6f6295e verified
FROM python:3.10.11
# Install dependencies from requirements.txt
COPY requirements.txt /tmp/
RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt && rm /tmp/requirements.txt
# Create a non-root user with a home directory
RUN useradd -m -u 1000 user
# Switch to the non-root user
USER user
# Set environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set working directory to the home directory of the user
WORKDIR $HOME/app
# Copy the application code and set the correct permissions
COPY --chown=user . $HOME/app
# Expose the port that the FastAPI app will run on
EXPOSE 7860
# Start the FastAPI app on port 7860, the default port expected by Hugging Face Spaces
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]