Spaces:
Running
Running
File size: 969 Bytes
819bacd aae751e 819bacd fe7c659 819bacd |
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 |
FROM python:3.9
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory and Gensim data directory
ENV HOME=/home/user \
GENSIM_DATA_DIR=/home/user/gensim-data \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Upgrade pip and install dependencies
COPY --chown=user ./Api/requirements.txt /home/user/app/requirements.txt
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir --upgrade -r /home/user/app/requirements.txt
# Install additional packages
USER root
RUN apt update && apt install -y ffmpeg
USER user
# Copy the application code and set the owner to the user
COPY --chown=user ./Api/app /home/user/app/app
# Expose the port the app runs on
EXPOSE 8000
# Command to run the application
CMD ["uvicorn", "app.api:app", "--host", "0.0.0.0", "--port", "8000"]
|