Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +23 -14
Dockerfile
CHANGED
|
@@ -1,18 +1,32 @@
|
|
| 1 |
-
# Use an official Ubuntu base image
|
| 2 |
FROM ubuntu:latest
|
| 3 |
|
| 4 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
|
| 6 |
# Install system dependencies
|
| 7 |
RUN apt-get update && \
|
| 8 |
-
apt-get install -y libopencv-dev
|
| 9 |
rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
RUN git clone https://github.com/Truoji/tengine-lite-yolov5s-tt100k.git
|
| 13 |
|
| 14 |
# Set the working directory to the cloned repository
|
| 15 |
-
WORKDIR /tengine-lite-yolov5s-tt100k
|
| 16 |
|
| 17 |
# Build the project
|
| 18 |
RUN mkdir build && \
|
|
@@ -21,18 +35,13 @@ RUN mkdir build && \
|
|
| 21 |
make
|
| 22 |
|
| 23 |
# Set environment variables
|
| 24 |
-
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}
|
| 25 |
-
|
| 26 |
-
# Install Python and pip
|
| 27 |
-
RUN apt-get update && \
|
| 28 |
-
apt-get install -y python3 python3-pip && \
|
| 29 |
-
rm -rf /var/lib/apt/lists/*
|
| 30 |
|
| 31 |
-
# Install
|
| 32 |
-
RUN pip3 install gradio
|
| 33 |
|
| 34 |
-
# Copy the gradio.app.py script into the container
|
| 35 |
-
COPY gradio.app.py /tengine-lite-yolov5s-tt100k/gradio.app.py
|
| 36 |
|
| 37 |
# Expose the port on which the web app will run
|
| 38 |
EXPOSE 7860
|
|
|
|
|
|
|
| 1 |
FROM ubuntu:latest
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
|
| 5 |
# Install system dependencies
|
| 6 |
RUN apt-get update && \
|
| 7 |
+
apt-get install -y libopencv-dev cmake build-essential python3 python3-pip && \
|
| 8 |
rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# Set up a new user named "user" with user ID 1000 and create the necessary directories
|
| 11 |
+
RUN useradd -m -u 1000 user && \
|
| 12 |
+
mkdir -p /home/user/app && \
|
| 13 |
+
chown -R user:user /home/user/app
|
| 14 |
+
|
| 15 |
+
# Switch to the "user" user
|
| 16 |
+
USER user
|
| 17 |
+
|
| 18 |
+
# Set home to the user's home directory
|
| 19 |
+
ENV HOME=/home/user \
|
| 20 |
+
PATH=/home/user/.local/bin:$PATH
|
| 21 |
+
|
| 22 |
+
# Set the working directory to the user's app directory
|
| 23 |
+
WORKDIR $HOME/app
|
| 24 |
+
|
| 25 |
+
# Clone the GitHub repository as the "user"
|
| 26 |
RUN git clone https://github.com/Truoji/tengine-lite-yolov5s-tt100k.git
|
| 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 && \
|
|
|
|
| 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
|