vikarshana commited on
Commit
15c28c7
·
verified ·
1 Parent(s): 8959f15

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -19
Dockerfile CHANGED
@@ -1,34 +1,35 @@
1
  FROM python:3.12-alpine
2
 
3
- # Install dependencies, including su-exec
4
- RUN apk update && apk add --no-cache ffmpeg su-exec
5
-
6
- # Create appuser and appgroup
7
- RUN addgroup -g 1000 appgroup && adduser -D -u 1000 -G appgroup appuser
8
-
9
- # Set environment variables
10
- ENV PYTHONDONTWRITEBYTECODE=1
11
- ENV PYTHONUNBUFFERED=1
12
- ENV PYTHONPATH=/app/tubetube
13
-
14
  # Set the working directory
15
  WORKDIR /app
16
 
17
- # Install Python dependencies
 
 
 
 
 
 
 
 
 
18
  COPY requirements.txt .
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
- # Copy the application code
22
  COPY . .
23
 
24
- # Ensure proper ownership of /config, /data and /temp directories
25
- RUN mkdir -p /config /data /temp && \
26
- chown -R appuser:appgroup /config /data /temp && \
27
- chmod -R 775 /temp
 
 
 
 
28
 
29
- # Copy start script and make it executable
30
  # Expose the application port
31
  EXPOSE 7860
32
 
33
- # Use the start script as the entrypoint
34
  CMD ["python", "srv.py"]
 
1
  FROM python:3.12-alpine
2
 
 
 
 
 
 
 
 
 
 
 
 
3
  # Set the working directory
4
  WORKDIR /app
5
 
6
+ # Install required system packages
7
+ RUN apt-get update && \
8
+ apt-get install -y ffmpeg && \
9
+ apt-get clean && \
10
+ rm -rf /var/lib/apt/lists/*
11
+
12
+ # Create a non-root user
13
+ RUN useradd -m -u 1000 appuser
14
+
15
+ # Copy requirements and install Python packages
16
  COPY requirements.txt .
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
+ # Copy the application files
20
  COPY . .
21
 
22
+ # Set permissions for all files and directories
23
+ RUN find /app -type f -exec chmod 644 {} \; && \
24
+ find /app -type d -exec chmod 755 {} \; && \
25
+ chmod 644 www.youtube.com_cookies.txt && \
26
+ chown -R appuser:appuser /app
27
+
28
+ # Switch to non-root user
29
+ USER appuser
30
 
 
31
  # Expose the application port
32
  EXPOSE 7860
33
 
34
+ # Command to run the application
35
  CMD ["python", "srv.py"]