File size: 1,780 Bytes
4464a90
 
 
 
 
 
 
 
0a7c6ee
 
 
09c4d3b
0a7c6ee
 
7b36781
 
 
 
0a7c6ee
 
 
7b36781
 
 
 
a84bc4e
7b36781
 
a84bc4e
7b36781
 
0a7c6ee
09c4d3b
4464a90
09c4d3b
4464a90
 
 
 
 
 
 
 
 
09c4d3b
 
 
4464a90
 
 
 
09c4d3b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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"]