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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -7
Dockerfile CHANGED
@@ -8,7 +8,7 @@ ENV DEBIAN_FRONTEND=noninteractive
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 \
@@ -21,16 +21,26 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
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
@@ -39,22 +49,22 @@ WORKDIR /home/user/app
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
 
8
  ENV PYTHONDONTWRITEBYTECODE=1
9
  ENV PYTHONUNBUFFERED=1
10
 
11
+ # Install system dependencies and add FEniCSx PPA
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
  software-properties-common \
14
  build-essential \
 
21
  python3.10 \
22
  python3.10-venv \
23
  python3-pip \
24
+ wget \
25
  && add-apt-repository ppa:fenics-packages/fenics -y \
26
  && apt-get update \
27
  && apt-get install -y fenicsx \
28
  && rm -rf /var/lib/apt/lists/*
29
 
30
+ # Create a virtual environment and activate it
31
+ RUN python3.10 -m venv /opt/venv
32
+
33
+ # Make the venv the default Python environment
34
+ ENV PATH="/opt/venv/bin:$PATH"
35
+
36
+ # Install FEniCSx Python bindings
37
+ RUN pip install fenics-dolfinx mpi4py
38
+
39
  # Verify FEniCSx installation
40
+ RUN python -c "import dolfinx; print('FEniCSx version:', dolfinx.__version__)"
41
 
42
  # Upgrade pip and install Python packages
43
+ RUN pip install --upgrade pip
44
 
45
  # Set work directory
46
  WORKDIR /home/user/app
 
49
  COPY requirements.txt /tmp/requirements.txt
50
 
51
  # Install Python packages from requirements.txt
52
+ RUN pip install --no-cache-dir -r /tmp/requirements.txt
53
 
54
  # Install additional Python packages
55
+ RUN pip install --no-cache-dir \
56
  gradio[oauth]==5.9.1 \
57
  "uvicorn>=0.14.0" \
58
  spaces
59
 
60
  # Update pip to the latest version after all installations
61
+ RUN pip install --upgrade pip
62
 
63
  # Copy the application code
64
  COPY --chown=1000:1000 ./ /home/user/app
65
 
66
  # Freeze installed packages (optional)
67
+ RUN pip freeze > /tmp/freeze.txt
68
 
69
  # Expose the port the app runs on (modify if necessary)
70
  EXPOSE 7860