FROM python:3.10 # Install necessary libraries RUN apt-get update && apt-get install -y \ git \ cmake \ libopencv-dev WORKDIR /code # Copy requirements and install dependencies 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 RUN useradd -m -u 1000 user # Switch to the "user" user USER user # Set home to the user's home directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set the working directory to the user's home directory WORKDIR $HOME/app # Clone and build the project RUN git clone https://github.com/Truoji/tengine-lite-yolov5s-tt100k && \ cd tengine-lite-yolov5s-tt100k && \ mkdir build && \ cd build && \ cmake .. && \ make # Set LD_LIBRARY_PATH to include third_party libraries ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/app/tengine-lite-yolov5s-tt100k/third_party/ # Copy the current directory contents into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app # Run the project CMD ["python", "gradio.app.py"]