admin08077 commited on
Commit
b68c6e2
·
verified ·
1 Parent(s): d8e1fe5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +50 -32
Dockerfile CHANGED
@@ -1,45 +1,63 @@
1
- # Use the official FEniCS Docker image as the base
2
- FROM quay.io/fenicsproject/stable:latest
3
 
4
- # Set environment variables to prevent interactive prompts during installation
5
  ENV DEBIAN_FRONTEND=noninteractive
6
 
7
- # Update package lists and install necessary system dependencies
8
- RUN apt-get update && apt-get install -y \
9
- python3-pip \
10
- python3-dev \
 
 
 
11
  build-essential \
12
- libgl1-mesa-glx \
13
- libglib2.0-0 \
 
 
 
 
 
 
 
 
 
 
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
- # Upgrade pip to the latest version
17
- RUN pip3 install --upgrade pip
18
 
19
- # Install Python dependencies
20
- RUN pip3 install --no-cache-dir \
21
- gradio \
22
- pandas \
23
- numpy \
24
- scikit-learn \
25
- sympy \
26
- matplotlib
27
 
28
- # Create a directory for the application
29
- WORKDIR /app
30
 
31
- # Copy the application code into the Docker image
32
- COPY app.py /app/
33
 
34
- # (Optional) If you have additional files like requirements.txt, include them
35
- # COPY requirements.txt /app/
36
 
37
- # Expose the port that Gradio will run on
38
- EXPOSE 7860
 
 
 
39
 
40
- # Set environment variables for Gradio to ensure it listens on all network interfaces
41
- ENV GRADIO_SERVER_NAME=0.0.0.0
42
- ENV GRADIO_SERVER_PORT=7860
 
 
 
 
 
 
 
 
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"]