basyx commited on
Commit
9b82df3
·
verified ·
1 Parent(s): 8644bd7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -10
Dockerfile CHANGED
@@ -1,20 +1,34 @@
1
- FROM python:3.11-slim
 
2
 
 
 
3
  RUN apt-get update && apt-get install -y \
4
  ffmpeg \
5
- fonts-dejavu-core \
6
  libmagic1 \
7
- && apt-get clean && rm -rf /var/lib/apt/lists/*
 
 
 
 
8
 
9
- RUN useradd -m -u 1000 user
10
- USER user
11
- WORKDIR /home/user/app
12
- ENV PATH="/home/user/.local/bin:$PATH"
13
 
14
- COPY --chown=user:user requirements.txt .
 
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
- COPY --chown=user:user . .
18
- RUN mkdir -p /home/user/app/temp
 
 
 
 
 
 
 
19
 
 
20
  CMD ["python", "app.py"]
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.10-slim
3
 
4
+ # Install system dependencies: ffmpeg for processing, wget for downloads,
5
+ # libmagic for file type detection, and fonts for text overlays.
6
  RUN apt-get update && apt-get install -y \
7
  ffmpeg \
8
+ wget \
9
  libmagic1 \
10
+ fonts-dejavu-core \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Set the working directory
14
+ WORKDIR /app
15
 
16
+ # Create a temp directory and set permissions for the Hugging Face user (ID 1000)
17
+ RUN mkdir -p /app/temp && chmod 777 /app/temp
 
 
18
 
19
+ # Copy requirements and install
20
+ COPY requirements.txt .
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # Copy the application code
24
+ COPY . .
25
+
26
+ # Set environment variables
27
+ ENV PYTHONUNBUFFERED=1
28
+ ENV TEMP_DIR=/app/temp
29
+
30
+ # Expose the port Gradio/FastAPI will run on
31
+ EXPOSE 7860
32
 
33
+ # Run the application
34
  CMD ["python", "app.py"]