ai_focus_new / Dockerfile
tuan243's picture
Update Dockerfile
ae13880 verified
raw
history blame
839 Bytes
FROM python:3.9
RUN pwd && ls -l
# Create a user with UID 1000
RUN useradd -m -u 1000 user
# Copy the requirements file to the /code directory
COPY ./requirements.txt /code/requirements.txt
# Install the Python dependencies with root and clean up cache
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt && rm -rf /root/.cache
# Switch to the user
USER user
# Set the working directory and user environment variables
ENV PATH=/home/user/.local/bin:$PATH
# Switch to the user's home directory
WORKDIR /home/user
# Copy the application files into the user's home directory
COPY --chown=user:user . /home/user
# Set the working directory for the application
WORKDIR /home/user
RUN pwd && ls -l
# Start the application using gunicorn
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "--timeout", "300", "main:app"]