Spaces:
Sleeping
Sleeping
SAAHMATHWORKS
commited on
Commit
Β·
0d844f7
1
Parent(s):
531a2b2
dorkerfile path
Browse files- Dockerfile +14 -13
Dockerfile
CHANGED
|
@@ -1,40 +1,41 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
-
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
-
# Set Python path to ensure imports work
|
| 7 |
ENV PYTHONPATH=/app:$PYTHONPATH
|
| 8 |
|
| 9 |
-
# Install system dependencies
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
gcc \
|
| 12 |
curl \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
# Copy requirements first (better layer caching)
|
| 16 |
COPY requirements.txt .
|
| 17 |
-
|
| 18 |
-
# Install Python dependencies
|
| 19 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 20 |
pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
-
# Copy
|
| 23 |
-
COPY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
# Create non-root user and set permissions
|
| 26 |
RUN useradd -m -u 1000 user && \
|
| 27 |
chown -R user:user /app
|
| 28 |
|
| 29 |
-
# Switch to non-root user
|
| 30 |
USER user
|
| 31 |
|
| 32 |
-
# Expose port (Hugging Face uses 7860)
|
| 33 |
EXPOSE 7860
|
| 34 |
|
| 35 |
-
# Health check
|
| 36 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 37 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 38 |
|
| 39 |
-
# Start command - Use python to run app.py (which then starts uvicorn)
|
| 40 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
ENV PYTHONPATH=/app:$PYTHONPATH
|
| 6 |
|
|
|
|
| 7 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
gcc \
|
| 9 |
curl \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
|
|
| 12 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 13 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 14 |
pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
+
# Copy ALL directories explicitly
|
| 17 |
+
COPY models/ ./models/
|
| 18 |
+
COPY core/ ./core/
|
| 19 |
+
COPY database/ ./database/
|
| 20 |
+
COPY api/ ./api/
|
| 21 |
+
COPY config/ ./config/
|
| 22 |
+
COPY utils/ ./utils/
|
| 23 |
+
COPY interfaces/ ./interfaces/
|
| 24 |
+
COPY *.py ./
|
| 25 |
+
|
| 26 |
+
# Debug: List what was copied
|
| 27 |
+
RUN echo "π Contents of /app:" && ls -la && \
|
| 28 |
+
echo "π Contents of /app/models:" && ls -la models/ && \
|
| 29 |
+
echo "π Contents of /app/core:" && ls -la core/
|
| 30 |
|
|
|
|
| 31 |
RUN useradd -m -u 1000 user && \
|
| 32 |
chown -R user:user /app
|
| 33 |
|
|
|
|
| 34 |
USER user
|
| 35 |
|
|
|
|
| 36 |
EXPOSE 7860
|
| 37 |
|
|
|
|
| 38 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 39 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 40 |
|
|
|
|
| 41 |
CMD ["python", "app.py"]
|