Spaces:
Sleeping
Sleeping
File size: 1,040 Bytes
7832703 37e7cb9 7832703 37e7cb9 7832703 37e7cb9 7832703 37e7cb9 7832703 37e7cb9 7832703 37e7cb9 7832703 37e7cb9 7832703 37e7cb9 7832703 |
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 |
# Use an official Python runtime as a parent image
FROM python:3.9
# Create a non-root user with a specified user ID
RUN useradd -m -u 1000 user
# Set environment variables for the non-root user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
NAME=EduConnect
# Set the non-root user's home directory as the working directory
WORKDIR $HOME
# Copy the application files into the non-root user's home directory, ensuring the user owns the copied files
COPY --chown=user:user . ./app
# Change to the non-root user
USER user
# Set the working directory to where the application files are
WORKDIR $HOME/app
# Install any needed packages specified in requirements.txt
# As the non-root user, ensure packages are installed to the user's home directory
RUN pip install --no-cache-dir --user -r requirements.txt
# Make port 7860 available to the world outside this container
EXPOSE 7860
# Run the FastAPI application using Uvicorn, binding to port 7860
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|