Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +9 -23
Dockerfile
CHANGED
|
@@ -1,33 +1,19 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
RUN apt-get update && apt-get install -y \
|
| 5 |
-
build-essential \
|
| 6 |
-
gcc \
|
| 7 |
-
g++ \
|
| 8 |
-
gfortran \
|
| 9 |
-
libopenblas-dev \
|
| 10 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
-
|
| 12 |
-
# Create user and upgrade pip
|
| 13 |
-
RUN useradd -m -u 1000 user
|
| 14 |
-
RUN python -m pip install --upgrade pip
|
| 15 |
-
|
| 16 |
-
USER user
|
| 17 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 18 |
-
|
| 19 |
-
WORKDIR /app
|
| 20 |
-
|
| 21 |
-
# Copy and install requirements first
|
| 22 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 23 |
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 24 |
|
|
|
|
|
|
|
|
|
|
| 25 |
# Copy all source code
|
| 26 |
COPY --chown=user . /app
|
| 27 |
|
| 28 |
-
#
|
| 29 |
WORKDIR /app/pysph/source
|
| 30 |
-
RUN pip install --no-cache-dir --user -e .
|
| 31 |
|
| 32 |
WORKDIR /app
|
| 33 |
|
|
@@ -36,4 +22,4 @@ ENV MCP_PORT=7860
|
|
| 36 |
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
-
CMD ["python", "pysph/mcp_output/start_mcp.py"]
|
|
|
|
| 1 |
+
# Install Cython and build dependencies first
|
| 2 |
+
RUN pip install --no-cache-dir --user cython numpy mako cyarray
|
| 3 |
|
| 4 |
+
# Copy and install requirements
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 6 |
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 7 |
|
| 8 |
+
# Try to install pysph from PyPI first (pre-compiled)
|
| 9 |
+
RUN pip install --no-cache-dir --user pysph || echo "PyPI installation failed, will build from source"
|
| 10 |
+
|
| 11 |
# Copy all source code
|
| 12 |
COPY --chown=user . /app
|
| 13 |
|
| 14 |
+
# Only build from source if PyPI installation failed
|
| 15 |
WORKDIR /app/pysph/source
|
| 16 |
+
RUN pip show pysph > /dev/null 2>&1 || pip install --no-cache-dir --user -e .
|
| 17 |
|
| 18 |
WORKDIR /app
|
| 19 |
|
|
|
|
| 22 |
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
+
CMD ["python", "pysph/mcp_output/start_mcp.py"]
|