Spaces:
Build error
Build error
Update Dockerfile
Browse files- 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
COPY requirements.txt .
|
| 19 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
|
| 21 |
-
# Copy the application
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
RUN
|
| 26 |
-
|
| 27 |
-
chmod
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
# Copy start script and make it executable
|
| 30 |
# Expose the application port
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
-
#
|
| 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"]
|