hassan526 commited on
Commit
e185710
·
1 Parent(s): 4fb9fd1

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +27 -0
  2. install.sh +38 -0
  3. run_demo.sh +10 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+
3
+ # Set the timezone of the container
4
+ ENV CONTAINER_TIMEZONE=UTC
5
+ RUN ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
6
+
7
+ # Create directory for the application
8
+ RUN mkdir -p /home/recognito_id
9
+
10
+ # Set the working directory
11
+ WORKDIR /home/recognito_id
12
+
13
+ # Copy the application files into the container
14
+ COPY . .
15
+
16
+ # Make the scripts executable
17
+ RUN chmod +x install.sh run_demo.sh
18
+
19
+ # Run the install.sh script to perform any installation tasks
20
+ RUN apt-get update && apt-get install -y sudo
21
+ RUN ./install.sh
22
+
23
+ # Expose port 8000(flask), 7860(gradio)
24
+ EXPOSE 8000 7860
25
+
26
+ # Set the default command to run the application
27
+ #ENTRYPOINT ["./run_demo.sh"]
install.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ echo "Install environment..."
4
+
5
+ . /etc/os-release
6
+ ubuntu_version="$VERSION_ID"
7
+ echo "Ubuntu version: $ubuntu_version"
8
+
9
+ # Check if the version is 22.04 or later
10
+ if [ "$ubuntu_version" \< "22.04" ]; then
11
+ # Print an error message and exit
12
+ echo "Error: Ubuntu version must be 22.04 or later"
13
+ exit 1
14
+ fi
15
+
16
+ # Install packages:
17
+ sudo apt-get install -y binutils python3 python3-pip python3-opencv libcurl4-openssl-dev libssl-dev libpcsclite-dev
18
+
19
+ # Install requirements:
20
+ python3 -m pip install --upgrade pip && python3 -m pip install opencv-python gradio
21
+
22
+ # Copy libraries to /usr/lib based on Ubuntu version
23
+ if [ "$ubuntu_version" = "20.04" ]; then
24
+ # Copy library for Ubuntu 20.04
25
+ sudo cp -f ./id_ocr/dependency/libimutils.so /usr/lib
26
+ elif [ "$ubuntu_version" = "22.04" ]; then
27
+ # Copy library for Ubuntu 22.04
28
+ sudo cp -f ./id_ocr/dependency/libimutils.so_for_ubuntu22 /usr/lib/libimutils.so
29
+ else
30
+ # Print an error message for unsupported Ubuntu versions
31
+ echo "Error: Unsupported Ubuntu version"
32
+ exit 1
33
+ fi
34
+
35
+ sudo cp -f ./id_ocr/dependency/libttvcore.so /usr/lib
36
+ sudo cp -rf ./id_live/dependency/* /usr/lib
37
+
38
+ echo "Installed successfully!"
run_demo.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ # Add the current directory to PYTHONPATH
4
+ export PYTHONPATH=$(dirname "$(pwd)"):$PYTHONPATH
5
+
6
+ # Set LD_LIBRARY_PATH
7
+ export LD_LIBRARY_PATH="/usr/lib/openvino:$LD_LIBRARY_PATH"
8
+
9
+ python3 app.py
10
+