Spaces:
Sleeping
Sleeping
SAAHMATHWORKS commited on
Commit Β·
9ca3c48
1
Parent(s): 331a5df
fix import path
Browse files- Dockerfile +11 -14
Dockerfile
CHANGED
|
@@ -1,41 +1,38 @@
|
|
| 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
|
| 17 |
-
COPY
|
| 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 |
-
|
| 32 |
-
|
| 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 |
-
|
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
+
# Set working directory
|
| 4 |
WORKDIR /app
|
|
|
|
| 5 |
ENV PYTHONPATH=/app:$PYTHONPATH
|
| 6 |
|
| 7 |
+
# Install system dependencies
|
| 8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
gcc \
|
| 10 |
curl \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Copy requirements and install them
|
| 14 |
COPY requirements.txt .
|
| 15 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 16 |
pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
+
# Copy your entire project into the container
|
| 19 |
+
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# Debug: List what was copied
|
| 22 |
RUN echo "π Contents of /app:" && ls -la && \
|
| 23 |
echo "π Contents of /app/models:" && ls -la models/ && \
|
| 24 |
echo "π Contents of /app/core:" && ls -la core/
|
| 25 |
|
| 26 |
+
# Create and switch to non-root user
|
| 27 |
+
RUN useradd -m -u 1000 user && chown -R user:user /app
|
|
|
|
| 28 |
USER user
|
| 29 |
|
| 30 |
+
# Expose port if you're running a web app (Gradio/FastAPI/etc.)
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
+
# Optional healthcheck
|
| 34 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 35 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 36 |
|
| 37 |
+
# Run your main script
|
| 38 |
+
CMD ["python", "app.py"]
|