Update Dockerfile
Browse files- Dockerfile +17 -20
Dockerfile
CHANGED
|
@@ -1,29 +1,26 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM python:3.10
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
USER appuser
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
COPY --chown=appuser requirements.txt .
|
| 16 |
-
|
| 17 |
-
# Install the dependencies
|
| 18 |
-
# Note: As a non-root user, pip will default to --user install, putting files in ~/.local
|
| 19 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
|
| 24 |
-
# Expose
|
| 25 |
EXPOSE 7860
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
|
| 29 |
-
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set up a new user 'user' with UID 1000
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
ENV HOME=/home/user \
|
| 8 |
+
PATH=/home/user/.local/bin:$PATH
|
| 9 |
|
| 10 |
+
# Set the working directory to /home/user/app
|
| 11 |
+
WORKDIR $HOME/app
|
|
|
|
| 12 |
|
| 13 |
+
# Copy the current directory contents into the container at /home/user/app
|
| 14 |
+
COPY --chown=user . .
|
| 15 |
|
| 16 |
+
# Install dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 18 |
|
| 19 |
+
# Create a directory for yt-dlp cache
|
| 20 |
+
RUN mkdir -p /tmp/.yt-dlp-cache && chmod 777 /tmp/.yt-dlp-cache
|
| 21 |
|
| 22 |
+
# Expose port 7860
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
+
# Start the application using uvicorn pointing to the ASGI-wrapped 'app' object
|
| 26 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|