Spaces:
Running
Running
File size: 1,082 Bytes
41311e9 59d0e56 41311e9 59d0e56 41311e9 59d0e56 41311e9 8f9e79a 59d0e56 41311e9 59d0e56 a1e71b8 59d0e56 a1e71b8 59d0e56 a1e71b8 59d0e56 a1e71b8 59d0e56 a1e71b8 59d0e56 |
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 |
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
# Use the official Python 3.9 image as the base image
FROM python:3.9
# Set the working directory to /code
WORKDIR /code
# Copy the requirements file into the container at /code/
COPY ./requirements.txt /code/requirements.txt
# Copy the FastAPI application code into the container
COPY ./app.py /app/app.py
# Install the required Python packages from requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Create a non-root user (optional but recommended for security)
RUN useradd -m -u 1000 user
# Switch to the non-root user
USER user
# Define environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Change the working directory to /home/user/app
WORKDIR $HOME/app
# Copy the rest of the application files into the container
COPY --chown=user . $HOME/app
# Specify the command to run your application (modify as needed)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|