Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +30 -36
Dockerfile
CHANGED
|
@@ -1,16 +1,31 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
-
RUN apt-get update && \
|
| 7 |
-
apt-get install -y libopencv-dev git cmake build-essential python3 python3-pip && \
|
| 8 |
-
rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
RUN
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Switch to the "user" user
|
| 16 |
USER user
|
|
@@ -19,32 +34,11 @@ USER user
|
|
| 19 |
ENV HOME=/home/user \
|
| 20 |
PATH=/home/user/.local/bin:$PATH
|
| 21 |
|
| 22 |
-
# Set the working directory to the user's
|
| 23 |
WORKDIR $HOME/app
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
# Set the working directory to the cloned repository
|
| 29 |
-
WORKDIR $HOME/app/tengine-lite-yolov5s-tt100k
|
| 30 |
-
|
| 31 |
-
# Build the project
|
| 32 |
-
RUN mkdir build && \
|
| 33 |
-
cd build && \
|
| 34 |
-
cmake .. && \
|
| 35 |
-
make
|
| 36 |
-
|
| 37 |
-
# Set environment variables
|
| 38 |
-
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/app/tengine-lite-yolov5s-tt100k/third_party/"
|
| 39 |
-
|
| 40 |
-
# Install Python packages as the "user"
|
| 41 |
-
RUN pip3 install --user gradio
|
| 42 |
-
|
| 43 |
-
# Copy the gradio.app.py script into the container at $HOME/app/tengine-lite-yolov5s-tt100k
|
| 44 |
-
COPY --chown=user gradio.app.py ${HOME}/app/tengine-lite-yolov5s-tt100k/gradio.app.py
|
| 45 |
-
|
| 46 |
-
# Expose the port on which the web app will run
|
| 47 |
-
EXPOSE 7860
|
| 48 |
|
| 49 |
-
# Run
|
| 50 |
-
CMD ["
|
|
|
|
| 1 |
+
FROM python:3.10
|
| 2 |
|
| 3 |
+
# Install necessary libraries
|
| 4 |
+
RUN apt-get update && apt-get install -y \
|
| 5 |
+
git \
|
| 6 |
+
cmake \
|
| 7 |
+
libopencv-dev
|
| 8 |
|
| 9 |
+
WORKDIR /code
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
# Clone the repository
|
| 12 |
+
RUN git clone https://github.com/Truoji/tengine-lite-yolov5s-tt100k .
|
| 13 |
+
|
| 14 |
+
# Create build directory and build the project
|
| 15 |
+
RUN mkdir build && cd build && cmake .. && make
|
| 16 |
+
|
| 17 |
+
# Set environment variable
|
| 18 |
+
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/code/third_party/
|
| 19 |
+
|
| 20 |
+
# Make yolov5s-tt100k executable
|
| 21 |
+
RUN chmod +x ./yolov5s-tt100k
|
| 22 |
+
|
| 23 |
+
# Copy requirements and install dependencies
|
| 24 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 25 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 26 |
+
|
| 27 |
+
# Set up a new user named "user" with user ID 1000
|
| 28 |
+
RUN useradd -m -u 1000 user
|
| 29 |
|
| 30 |
# Switch to the "user" user
|
| 31 |
USER user
|
|
|
|
| 34 |
ENV HOME=/home/user \
|
| 35 |
PATH=/home/user/.local/bin:$PATH
|
| 36 |
|
| 37 |
+
# Set the working directory to the user's home directory
|
| 38 |
WORKDIR $HOME/app
|
| 39 |
|
| 40 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 41 |
+
COPY --chown=user . $HOME/app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
# Run the project
|
| 44 |
+
CMD ["python", "gradio.app.py"]
|