Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +12 -7
Dockerfile
CHANGED
|
@@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 12 |
curl \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
# Copy requirements
|
| 16 |
COPY requirements.txt /app/requirements.txt
|
| 17 |
|
| 18 |
# Upgrade pip
|
|
@@ -21,15 +21,20 @@ RUN python -m pip install --upgrade pip setuptools wheel
|
|
| 21 |
# Install requirements
|
| 22 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
|
| 24 |
-
# Copy app code
|
| 25 |
COPY . /app/
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# Hugging Face Spaces uses port 7860
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
-
# Use entrypoint
|
| 34 |
-
ENTRYPOINT ["/
|
| 35 |
-
|
|
|
|
| 12 |
curl \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
+
# Copy requirements first (for better caching)
|
| 16 |
COPY requirements.txt /app/requirements.txt
|
| 17 |
|
| 18 |
# Upgrade pip
|
|
|
|
| 21 |
# Install requirements
|
| 22 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
|
| 24 |
+
# Copy all app code
|
| 25 |
COPY . /app/
|
| 26 |
|
| 27 |
+
# Handle entrypoint script (rename if needed and make executable
|
| 28 |
+
RUN if [ -f /app/scripts/entrypoint_hf.sh ]; then \
|
| 29 |
+
mv /app/scripts/entrypoint_hf.sh /app/scripts/entrypoint.sh; \
|
| 30 |
+
fi && \
|
| 31 |
+
if [ -f /app/scripts/entrypoint.sh ]; then \
|
| 32 |
+
chmod +x /app/scripts/entrypoint.sh; \
|
| 33 |
+
fi
|
| 34 |
|
| 35 |
# Hugging Face Spaces uses port 7860
|
| 36 |
EXPOSE 7860
|
| 37 |
|
| 38 |
+
# Use entrypoint if exists, otherwise run main.py directly
|
| 39 |
+
ENTRYPOINT ["/bin/sh", "-c"]
|
| 40 |
+
CMD ["if [ -f /app/scripts/entrypoint.sh ]; then exec /app/scripts/entrypoint.sh; else PORT=7860 exec python main.py; fi"]
|