Spaces:
Sleeping
Sleeping
File size: 1,002 Bytes
47ffab5 5ebef9c 0c6a58b ed88d29 0c6a58b 2a00cb3 0c6a58b 5ebef9c 0c6a58b 5ebef9c 0c6a58b 5ebef9c 0c6a58b 47ffab5 c0dff48 0c6a58b 2a00cb3 0c6a58b b5d531c |
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 36 37 38 |
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 ./FastAPI/requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir --upgrade -r /code/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 . $HOME/app
# Copy the FastAPI app separately
COPY ./FastAPI/app /code/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"]
|