debug / Dockerfile
FarahMohsenSamy1's picture
Update Dockerfile
8022f4b verified
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install necessary dependencies
RUN apt-get update && apt-get install -y busybox wget curl && rm -rf /var/lib/apt/lists/*
# Create cache directories with proper permissions BEFORE installing packages
RUN mkdir -p /app/cache/huggingface /app/cache/transformers /app/cache/datasets
RUN chmod -R 777 /app/cache
# Set Hugging Face environment variables
ENV HF_HOME=/app/cache/huggingface
ENV TRANSFORMERS_CACHE=/app/cache/transformers
ENV HF_DATASETS_CACHE=/app/cache/datasets
ENV HUGGINGFACE_HUB_CACHE=/app/cache/huggingface
ENV HF_HUB_CACHE=/app/cache/huggingface
# Install Python dependencies
RUN pip install --no-cache-dir \
torch==2.0.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
RUN pip install --no-cache-dir \
pandas "numpy<2" matplotlib scikit-learn tqdm scipy networkx \
torch-geometric requests schedule fastapi uvicorn jinja2 python-multipart gradio datasets
# Create necessary directories with correct permissions
RUN mkdir -p /app/logs /app/models /app/scripts /app/data /app/templates
# Change ownership and permissions to avoid permission issues
RUN chmod -R 777 /app/models /app/logs /app/data
# Copy scripts and data
COPY train.py /app/train.py
COPY scheduler.py /app/scheduler.py
COPY transactions.csv /app/transactions.csv
COPY app.py /app/app.py
# Make scripts executable
RUN chmod +x /app/train.py /app/scheduler.py
# Run both FastAPI server and the training scheduler in parallel
CMD ["sh", "-c", "python scheduler.py && python app.py"]