Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +25 -17
Dockerfile
CHANGED
|
@@ -1,29 +1,37 @@
|
|
| 1 |
-
FROM python:3.
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
|
| 11 |
-
#
|
| 12 |
COPY requirements.txt .
|
| 13 |
-
RUN pip install -r requirements.txt
|
| 14 |
|
| 15 |
-
# Copy the application
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
RUN
|
| 20 |
-
|
| 21 |
-
chmod
|
| 22 |
-
chown -R appuser:appuser /app
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
|
|
|
| 26 |
|
|
|
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
| 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 |
+
COPY start.sh /app/start.sh
|
| 31 |
+
RUN chmod +x /app/start.sh
|
| 32 |
|
| 33 |
+
# Expose the application port
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
+
# Use the start script as the entrypoint
|
| 37 |
+
ENTRYPOINT ["/app/start.sh"]
|