File size: 935 Bytes
25a173a 6c0ac6b 337a72c 28669c0 337a72c 28669c0 337a72c b0c2749 337a72c b0c2749 337a72c e4eb15d 337a72c e4eb15d 337a72c e4eb15d 337a72c e4eb15d debd24a 337a72c 7e9fa29 337a72c c57116e 9d69895 337a72c |
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 38 |
FROM python:3.10.9
# Use a more secure method for setting the working directory
WORKDIR /app
# Copy the requirements file
COPY ./requirements.txt /app/requirements.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
RUN apt update && apt install -y ffmpeg
# Add and configure the user
RUN useradd -m -u 1000 user
# Set environment variables for the user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the user and working directory
USER user
WORKDIR $HOME/app
# Copy the application code
COPY --chown=user . $HOME/app
# Ensure the user has the correct permissions
RUN chmod -R 777 $HOME/app
# Set additional environment variables
ENV NUMBA_CACHE_DIR=/tmp/NUMBA_CACHE_DIR/
ENV MPLCONFIGDIR=/tmp/MPLCONFIGDIR/
ENV HOME=/home/user
ENV PATH="/opt/venv/bin:$PATH"
# Set the command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|