Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +50 -32
Dockerfile
CHANGED
|
@@ -1,45 +1,63 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
#
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
build-essential \
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
RUN
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
RUN
|
| 21 |
-
gradio \
|
| 22 |
-
pandas \
|
| 23 |
-
numpy \
|
| 24 |
-
scikit-learn \
|
| 25 |
-
sympy \
|
| 26 |
-
matplotlib
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
WORKDIR /app
|
| 30 |
|
| 31 |
-
# Copy
|
| 32 |
-
COPY
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
|
| 36 |
|
| 37 |
-
#
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
# Define the command to run the application
|
| 45 |
-
CMD ["python3", "app.py"]
|
|
|
|
| 1 |
+
# Use an official Ubuntu base image
|
| 2 |
+
FROM ubuntu:22.04
|
| 3 |
|
| 4 |
+
# Prevent interactive prompts during package installation
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
|
| 7 |
+
# Set environment variables
|
| 8 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 9 |
+
ENV PYTHONUNBUFFERED=1
|
| 10 |
+
|
| 11 |
+
# Install system dependencies and add FEniCS PPA
|
| 12 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 13 |
+
software-properties-common \
|
| 14 |
build-essential \
|
| 15 |
+
cmake \
|
| 16 |
+
git \
|
| 17 |
+
ffmpeg \
|
| 18 |
+
git-lfs \
|
| 19 |
+
curl \
|
| 20 |
+
nodejs \
|
| 21 |
+
python3.10 \
|
| 22 |
+
python3.10-venv \
|
| 23 |
+
python3-pip \
|
| 24 |
+
&& add-apt-repository ppa:fenics-packages/fenics -y \
|
| 25 |
+
&& apt-get update \
|
| 26 |
+
&& apt-get install -y fenicsx \
|
| 27 |
&& rm -rf /var/lib/apt/lists/*
|
| 28 |
|
| 29 |
+
# Verify FEniCSx installation
|
| 30 |
+
RUN python3.10 -c "import dolfinx; print('FEniCSx version:', dolfinx.__version__)"
|
| 31 |
|
| 32 |
+
# Upgrade pip and install Python packages
|
| 33 |
+
RUN python3.10 -m pip install --upgrade pip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
# Set work directory
|
| 36 |
+
WORKDIR /home/user/app
|
| 37 |
|
| 38 |
+
# Copy requirements file
|
| 39 |
+
COPY requirements.txt /tmp/requirements.txt
|
| 40 |
|
| 41 |
+
# Install Python packages from requirements.txt
|
| 42 |
+
RUN python3.10 -m pip install --no-cache-dir -r /tmp/requirements.txt
|
| 43 |
|
| 44 |
+
# Install additional Python packages
|
| 45 |
+
RUN python3.10 -m pip install --no-cache-dir \
|
| 46 |
+
gradio[oauth]==5.9.1 \
|
| 47 |
+
"uvicorn>=0.14.0" \
|
| 48 |
+
spaces
|
| 49 |
|
| 50 |
+
# Update pip to the latest version after all installations
|
| 51 |
+
RUN python3.10 -m pip install --upgrade pip
|
| 52 |
+
|
| 53 |
+
# Copy the application code
|
| 54 |
+
COPY --chown=1000:1000 ./ /home/user/app
|
| 55 |
+
|
| 56 |
+
# Freeze installed packages (optional)
|
| 57 |
+
RUN python3.10 -m pip freeze > /tmp/freeze.txt
|
| 58 |
+
|
| 59 |
+
# Expose the port the app runs on (modify if necessary)
|
| 60 |
+
EXPOSE 7860
|
| 61 |
|
| 62 |
+
# Define the default command to run the application
|
| 63 |
+
CMD ["python3.10", "app.py"]
|