Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +10 -16
Dockerfile
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
# Use standard Python 3.9 slim image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set environment variables
|
|
@@ -7,20 +6,16 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
| 7 |
PORT=8000 \
|
| 8 |
HF_HOME=/cache \
|
| 9 |
HUGGINGFACE_HUB_CACHE=/cache \
|
|
|
|
| 10 |
PIP_NO_CACHE_DIR=1 \
|
| 11 |
TOKENIZERS_PARALLELISM=false
|
| 12 |
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
-
# Create directory structure
|
| 16 |
-
RUN mkdir -p \
|
| 17 |
-
/
|
| 18 |
-
/app/src
|
| 19 |
-
/app/config \
|
| 20 |
-
/app/templates \
|
| 21 |
-
/app/static/css \
|
| 22 |
-
/app/tests \
|
| 23 |
-
/cache
|
| 24 |
|
| 25 |
# Install system dependencies
|
| 26 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
@@ -35,15 +30,14 @@ RUN pip install --upgrade pip && \
|
|
| 35 |
# Copy application files
|
| 36 |
COPY . .
|
| 37 |
|
|
|
|
|
|
|
|
|
|
| 38 |
# Set proper permissions
|
| 39 |
-
RUN chmod -R a+
|
|
|
|
| 40 |
find /app -type d -exec chmod a+rx {} \;
|
| 41 |
|
| 42 |
-
# Health check (use actual port number)
|
| 43 |
-
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
| 44 |
-
CMD curl -f http://localhost:8000/health || exit 1
|
| 45 |
-
|
| 46 |
EXPOSE 8000
|
| 47 |
|
| 48 |
-
# Run command (use actual port number)
|
| 49 |
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "120", "app:app"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
# Set environment variables
|
|
|
|
| 6 |
PORT=8000 \
|
| 7 |
HF_HOME=/cache \
|
| 8 |
HUGGINGFACE_HUB_CACHE=/cache \
|
| 9 |
+
TRANSFORMERS_CACHE=/cache \
|
| 10 |
PIP_NO_CACHE_DIR=1 \
|
| 11 |
TOKENIZERS_PARALLELISM=false
|
| 12 |
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
+
# Create directory structure with correct permissions
|
| 16 |
+
RUN mkdir -p /cache && \
|
| 17 |
+
chmod 777 /cache && \
|
| 18 |
+
mkdir -p /app/{data,src,config,templates,static/css,tests}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Install system dependencies
|
| 21 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 30 |
# Copy application files
|
| 31 |
COPY . .
|
| 32 |
|
| 33 |
+
# Verify src/history.py exists
|
| 34 |
+
RUN test -f /app/src/history.py || { echo "Error: history.py missing!"; exit 1; }
|
| 35 |
+
|
| 36 |
# Set proper permissions
|
| 37 |
+
RUN chmod -R a+rw /cache && \
|
| 38 |
+
chmod -R a+r /app && \
|
| 39 |
find /app -type d -exec chmod a+rx {} \;
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
EXPOSE 8000
|
| 42 |
|
|
|
|
| 43 |
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "120", "app:app"]
|