Yousuf-Islam's picture
Create Dockerfile
c4fbd52 verified
raw
history blame contribute delete
697 Bytes
# Use Python 3.9
FROM python:3.9
# Set working directory
WORKDIR /code
# Copy requirements and install
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Set up a new user named "user" with user ID 1000
# This is REQUIRED by Hugging Face Spaces for security
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Copy the current directory contents into the container at /home/user/app
COPY --chown=user . $HOME/app
# Set working directory to the app folder
WORKDIR $HOME/app
# Run the application
CMD ["python", "app.py"]