Perilon commited on
Commit
6aac4dc
·
1 Parent(s): bdf78b8
Files changed (4) hide show
  1. Dockerfile +13 -4
  2. __init__.py +0 -0
  3. entrypoint.sh +18 -0
  4. flask_app.py +2 -0
Dockerfile CHANGED
@@ -14,9 +14,20 @@ RUN mkdir -p /home/user && \
14
  chown -R 1000:1000 /home/user
15
  ENV HOME="/home/user"
16
 
 
 
 
17
  # Copy application code
18
  COPY . .
19
 
 
 
 
 
 
 
 
 
20
  # Set environment variables
21
  ENV PYTHONUNBUFFERED=1
22
  ENV PORT=7860
@@ -28,9 +39,6 @@ ENV S3_BUCKET="sorenson-ai-sb-scratch"
28
  ENV S3_VIDEO_PREFIX="awilkinson/kylie_dataset_videos_for_alignment_webapp/"
29
  ENV USE_S3_FOR_VIDEOS="true"
30
 
31
- # Create necessary directories
32
- RUN mkdir -p data/videos data/annotations data/temp data/word_timestamps data/alignments data/transcripts
33
-
34
  # Make port available
35
  EXPOSE 7860
36
 
@@ -40,4 +48,5 @@ RUN ls -la /app && \
40
  which gunicorn && \
41
  pip list
42
 
43
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "flask_app:app"]
 
 
14
  chown -R 1000:1000 /home/user
15
  ENV HOME="/home/user"
16
 
17
+ # Create necessary directories
18
+ RUN mkdir -p data/videos data/annotations data/temp data/word_timestamps data/alignments data/transcripts
19
+
20
  # Copy application code
21
  COPY . .
22
 
23
+ # Add entrypoint script
24
+ COPY entrypoint.sh /app/
25
+ RUN chmod +x /app/entrypoint.sh
26
+
27
+ # Set proper permissions
28
+ RUN chmod -R 755 /app && \
29
+ chmod -R 777 /app/data
30
+
31
  # Set environment variables
32
  ENV PYTHONUNBUFFERED=1
33
  ENV PORT=7860
 
39
  ENV S3_VIDEO_PREFIX="awilkinson/kylie_dataset_videos_for_alignment_webapp/"
40
  ENV USE_S3_FOR_VIDEOS="true"
41
 
 
 
 
42
  # Make port available
43
  EXPOSE 7860
44
 
 
48
  which gunicorn && \
49
  pip list
50
 
51
+ # Use entrypoint script
52
+ CMD ["/app/entrypoint.sh"]
__init__.py ADDED
File without changes
entrypoint.sh ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "Starting application..."
5
+ echo "Current directory: $(pwd)"
6
+ echo "Files in directory:"
7
+ ls -la
8
+
9
+ # Ensure proper permissions
10
+ chmod -R 777 /app/data
11
+
12
+ # Debug information
13
+ python3 -m pip list
14
+ which gunicorn
15
+ which python3
16
+
17
+ # Start the application
18
+ exec gunicorn --bind 0.0.0.0:7860 flask_app:app
flask_app.py CHANGED
@@ -1279,6 +1279,8 @@ def transcription_progress(video_id):
1279
  return jsonify(progress)
1280
 
1281
  if __name__ == '__main__':
 
 
1282
  try:
1283
  # Print diagnostic information
1284
  print("=" * 50)
 
1279
  return jsonify(progress)
1280
 
1281
  if __name__ == '__main__':
1282
+ port = int(os.getenv('PORT', 7860))
1283
+ app.run(host='0.0.0.0', port=port)
1284
  try:
1285
  # Print diagnostic information
1286
  print("=" * 50)