Ericwang commited on
Commit
c1137be
·
1 Parent(s): 4d1a4b3

update the dockerfile to solve errors

Browse files
Files changed (3) hide show
  1. .gitignore +2 -2
  2. Dockerfile +15 -19
  3. requirements.txt +1 -1
.gitignore CHANGED
@@ -1,3 +1,3 @@
1
- flagged/
2
  __pycache__/
3
- .DS_Store
 
1
+ .DS_Store
2
  __pycache__/
3
+ flagged/
Dockerfile CHANGED
@@ -1,33 +1,29 @@
 
1
  FROM python:3.9-slim-buster
2
 
 
3
  WORKDIR /app
4
 
 
5
  COPY requirements.txt .
6
 
 
7
  RUN pip install --no-cache-dir -r requirements.txt
8
 
 
9
  RUN apt-get update && apt-get install -y ffmpeg
10
 
 
11
  ENV MPLCONFIGDIR /tmp/matplotlib
12
 
13
- RUN mkdir /app/results_vc
14
- RUN chmod -R 777 /app/results_vc
 
 
 
15
 
16
- RUN mkdir /app/results_vt
17
- RUN chmod -R 777 /app/results_vt
18
 
19
- RUN mkdir /app/results_wt
20
- RUN chmod -R 777 /app/results_wt
21
-
22
- RUN mkdir /app/results_st
23
- RUN chmod -R 777 /app/results_st
24
-
25
- RUN mkdir /app/results_vtr
26
- RUN chmod -R 777 /app/results_vtr
27
-
28
- RUN mkdir /app/logs
29
- RUN chmod -R 777 /app/logs
30
-
31
- COPY . .
32
-
33
- CMD ["python", "app.py"]
 
1
+ # Use the lightweight Python 3.9 image based on Debian Buster
2
  FROM python:3.9-slim-buster
3
 
4
+ # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
+ # Copy just the requirements.txt first to leverage Docker cache
8
  COPY requirements.txt .
9
 
10
+ # Install Python dependencies without storing cache, for a smaller image
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Update package lists and install FFmpeg for media processing
14
  RUN apt-get update && apt-get install -y ffmpeg
15
 
16
+ # Set an environment variable for Matplotlib to store its configuration in /tmp
17
  ENV MPLCONFIGDIR /tmp/matplotlib
18
 
19
+ # Create and set permissions for result directories and logs inside the container
20
+ # Using a loop can reduce the number of layers and make the Dockerfile cleaner
21
+ RUN for dir in results_vc results_vt results_wt results_st results_vtr logs; do \
22
+ mkdir /app/$dir && chmod -R 777 /app/$dir; \
23
+ done
24
 
25
+ # Copy all Python files from the current directory to the container
26
+ COPY *.py .
27
 
28
+ # Specify the command to run on container start
29
+ CMD ["python", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- gradio==3.26.0
2
  moviepy==1.0.3
3
  pandas==1.1.3
4
  xlrd==1.2.0
 
1
+ gradio==3.47.1
2
  moviepy==1.0.3
3
  pandas==1.1.3
4
  xlrd==1.2.0