Spaces:
Running
Running
tiffank1802
Fix conda ToS: explicitly remove all default channels and use --override-channels
7b36781
| FROM python:3.11-slim | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| wget \ | |
| bash \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Miniforge (conda-forge only, no ToS issues) | |
| RUN wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O /tmp/miniforge.sh \ | |
| && bash /tmp/miniforge.sh -b -p /opt/conda \ | |
| && rm /tmp/miniforge.sh | |
| ENV PATH="/opt/conda/bin:${PATH}" | |
| # Remove ALL default channels and use ONLY conda-forge to avoid ToS issues | |
| RUN conda config --remove channels defaults 2>/dev/null || true && \ | |
| conda config --remove channels https://repo.anaconda.com/pkgs/main 2>/dev/null || true && \ | |
| conda config --remove channels https://repo.anaconda.com/pkgs/r 2>/dev/null || true && \ | |
| conda config --add channels conda-forge && \ | |
| conda config --set channel_priority strict && \ | |
| conda config --show channels | |
| # Install FEniCS via conda-forge ONLY | |
| RUN conda install -c conda-forge --override-channels fenics-dolfinx mpich petsc4py -y && conda clean -afy | |
| # Install Python dependencies (use conda's pip) | |
| COPY requirements.txt . | |
| RUN /opt/conda/bin/pip install --no-cache-dir -r requirements.txt | |
| # Copy application files | |
| COPY backend/ ./backend/ | |
| COPY static/ ./static/ | |
| COPY DangVan/ ./DangVan/ | |
| # Create directories for results and database | |
| RUN mkdir -p /app/backend/simulation_results && chmod 777 /app/backend/simulation_results | |
| # Copy entrypoint script | |
| COPY entrypoint.sh /app/entrypoint.sh | |
| RUN chmod +x /app/entrypoint.sh | |
| # HF Spaces uses port 7860 | |
| EXPOSE 7860 | |
| # Run entrypoint (handles migrations and starts server) | |
| CMD ["/app/entrypoint.sh"] | |