file-sharing-server / Dockerfile
slimshadow's picture
Update Dockerfile
9b742cc verified
raw
history blame contribute delete
776 Bytes
# Use the official Python image from the Docker Hub
FROM python:3.9
# Create a new user with UID 1000
RUN useradd -m -u 1000 user
# Switch to the new user
USER user
# Update the PATH environment variable
ENV PATH="/home/user/.local/bin:$PATH"
# Set the working directory to /app
WORKDIR /app
# Copy the requirements.txt file and change the ownership to the user
COPY --chown=user ./requirements.txt requirements.txt
# Install the dependencies from requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the rest of the application code and change the ownership to the user
COPY --chown=user . /app
# Set the command to run the application using Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "8"]