Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +40 -59
Dockerfile
CHANGED
|
@@ -1,66 +1,47 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
user=root
|
| 4 |
-
logfile=/dev/null
|
| 5 |
-
logfile_maxbytes=0
|
| 6 |
-
pidfile=/tmp/supervisord.pid
|
| 7 |
-
loglevel=info
|
| 8 |
|
| 9 |
-
|
| 10 |
-
serverurl=unix:///tmp/supervisor.sock
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
directory=/app
|
| 22 |
-
autostart=true
|
| 23 |
-
autorestart=true
|
| 24 |
-
startsecs=5
|
| 25 |
-
startretries=10
|
| 26 |
-
stopasgroup=true
|
| 27 |
-
killasgroup=true
|
| 28 |
-
stdout_logfile=/dev/stdout
|
| 29 |
-
stdout_logfile_maxbytes=0
|
| 30 |
-
stderr_logfile=/dev/stderr
|
| 31 |
-
stderr_logfile_maxbytes=0
|
| 32 |
-
environment=PORT=7860,DASHBOARD_HTML=/app/hub_dashboard.html,PYTHONUNBUFFERED=1
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
autostart=true
|
| 38 |
-
autorestart=true
|
| 39 |
-
startsecs=5
|
| 40 |
-
startretries=10
|
| 41 |
-
stopasgroup=true
|
| 42 |
-
killasgroup=true
|
| 43 |
-
stdout_logfile=/dev/stdout
|
| 44 |
-
stdout_logfile_maxbytes=0
|
| 45 |
-
stderr_logfile=/dev/stderr
|
| 46 |
-
stderr_logfile_maxbytes=0
|
| 47 |
-
environment=PYTHONUNBUFFERED=1
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
directory=/app
|
| 52 |
-
autostart=true
|
| 53 |
-
autorestart=true
|
| 54 |
-
startsecs=5
|
| 55 |
-
startretries=10
|
| 56 |
-
stopasgroup=true
|
| 57 |
-
killasgroup=true
|
| 58 |
-
stdout_logfile=/dev/stdout
|
| 59 |
-
stdout_logfile_maxbytes=0
|
| 60 |
-
stderr_logfile=/dev/stderr
|
| 61 |
-
stderr_logfile_maxbytes=0
|
| 62 |
-
environment=PYTHONUNBUFFERED=1,DASHBOARD_HTML=/app/hub_dashboard.html,RANKER_LOG_DIR=/app/ranker_logs,DASHBOARD_PORT=8051
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use official Python 3.11 slim image
|
| 2 |
+
FROM python:3.11-slim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
WORKDIR /app
|
|
|
|
| 5 |
|
| 6 |
+
# Install system dependencies
|
| 7 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
+
build-essential \
|
| 9 |
+
git \
|
| 10 |
+
curl \
|
| 11 |
+
wget \
|
| 12 |
+
supervisor \
|
| 13 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
+
# ββ Remove ALL default supervisor configs shipped by apt βββββββββββββββββββββ
|
| 16 |
+
RUN rm -f /etc/supervisor/supervisord.conf \
|
| 17 |
+
/etc/supervisor/conf.d/*.conf
|
| 18 |
|
| 19 |
+
# Copy requirements first (for layer caching)
|
| 20 |
+
COPY requirements.txt .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
# Install Python dependencies
|
| 23 |
+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
| 24 |
+
pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
# Copy application code
|
| 27 |
+
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
# ββ Place our supervisor config at the root level so it is fully standalone ββ
|
| 30 |
+
COPY supervisord.conf /etc/supervisord.conf
|
| 31 |
+
RUN chmod 644 /etc/supervisord.conf
|
| 32 |
+
|
| 33 |
+
# ββ Copy and permission the entrypoint cleanup script ββββββββββββββββββββββββ
|
| 34 |
+
COPY entrypoint.sh /entrypoint.sh
|
| 35 |
+
RUN chmod +x /entrypoint.sh
|
| 36 |
+
|
| 37 |
+
# ββ Create runtime directories with correct permissions ββββββββββββββββββββββ
|
| 38 |
+
RUN mkdir -p /app/logs /app/ranker_logs && \
|
| 39 |
+
chmod 777 /app/logs /app/ranker_logs
|
| 40 |
+
|
| 41 |
+
# Expose hub (7860 = HuggingFace public) + dashboard (8051 = internal)
|
| 42 |
+
EXPOSE 7860 8051
|
| 43 |
+
|
| 44 |
+
USER root
|
| 45 |
+
|
| 46 |
+
# Entrypoint cleans up stale state, then execs supervisord
|
| 47 |
+
CMD ["/entrypoint.sh"]
|