Spaces:
Sleeping
Sleeping
uBaby4life commited on
Commit ·
8212c88
1
Parent(s): 69a586e
Fix Dockerfile ENV syntax and ensure gdown in requirements
Browse files- Dockerfile +1 -20
Dockerfile
CHANGED
|
@@ -1,42 +1,23 @@
|
|
| 1 |
-
# Start from a Python base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# Set environment variables
|
| 5 |
ENV PYTHONUNBUFFERED=1 \
|
| 6 |
-
# Ensures that Python output is sent straight to terminal without being first buffered
|
| 7 |
-
# and that can be helpful for logging.
|
| 8 |
PIP_NO_CACHE_DIR=off \
|
| 9 |
-
# Disables pip caching, which can reduce image size.
|
| 10 |
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
| 11 |
-
# Disables the check for a new version of pip, speeding up builds.
|
| 12 |
PIP_DEFAULT_TIMEOUT=100 \
|
| 13 |
-
# Increases the default timeout for pip.
|
| 14 |
HF_HUB_DISABLE_SYMLINKS_WARNING=1
|
| 15 |
-
# To suppress the symlink warning from huggingface_hub
|
| 16 |
|
| 17 |
-
# Create a non-root user and switch to it
|
| 18 |
RUN useradd -m -u 1000 user
|
| 19 |
USER user
|
| 20 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 21 |
|
| 22 |
-
# Set the working directory in the container
|
| 23 |
WORKDIR /app
|
| 24 |
|
| 25 |
-
# Copy requirements.txt first to leverage Docker cache
|
| 26 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 27 |
|
| 28 |
-
# Install Python dependencies (including gdown)
|
| 29 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 30 |
|
| 31 |
-
# Copy the rest of the application code into the container
|
| 32 |
-
# This will include app.py, static/, templates/, LICENSE, README.md
|
| 33 |
-
# AND model_files/tokenizers/ (but NOT model_files/best_model.pth)
|
| 34 |
COPY --chown=user . .
|
| 35 |
|
| 36 |
-
# Expose the port the app will run on. HF Spaces expects 7860 for Docker.
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
-
# Command to run the application using Gunicorn
|
| 40 |
-
# It will listen on all interfaces (0.0.0.0) on port 7860.
|
| 41 |
-
# app:app means "in the file app.py, use the Flask instance named app".
|
| 42 |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "2", "--timeout", "0", "app:app"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
ENV PYTHONUNBUFFERED=1 \
|
|
|
|
|
|
|
| 4 |
PIP_NO_CACHE_DIR=off \
|
|
|
|
| 5 |
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
|
|
|
| 6 |
PIP_DEFAULT_TIMEOUT=100 \
|
|
|
|
| 7 |
HF_HUB_DISABLE_SYMLINKS_WARNING=1
|
|
|
|
| 8 |
|
|
|
|
| 9 |
RUN useradd -m -u 1000 user
|
| 10 |
USER user
|
| 11 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 12 |
|
|
|
|
| 13 |
WORKDIR /app
|
| 14 |
|
|
|
|
| 15 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 16 |
|
|
|
|
| 17 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
COPY --chown=user . .
|
| 20 |
|
|
|
|
| 21 |
EXPOSE 7860
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "2", "--timeout", "0", "app:app"]
|