cxeep commited on
Commit
f84b5cd
·
verified ·
1 Parent(s): d10d399

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -36
Dockerfile CHANGED
@@ -1,16 +1,31 @@
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 git 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
@@ -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 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 && \
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 gradio.app.py when the container launches
50
- CMD ["python3", "gradio.app.py"]
 
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"]