admin08077 commited on
Commit
458a310
·
verified ·
1 Parent(s): cf28599

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -31
Dockerfile CHANGED
@@ -1,14 +1,14 @@
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 FEniCSx PPA
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
  software-properties-common \
14
  build-essential \
@@ -27,47 +27,32 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
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
47
-
48
- # Copy requirements file
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
71
 
72
- # Define the default command to run the application
73
  CMD ["python3.10", "app.py"]
 
1
+ # Base Image
2
  FROM ubuntu:22.04
3
 
4
+ # Non-interactive setup for APT
5
  ENV DEBIAN_FRONTEND=noninteractive
6
 
7
+ # Python environment variables
8
  ENV PYTHONDONTWRITEBYTECODE=1
9
  ENV PYTHONUNBUFFERED=1
10
 
11
+ # Install system dependencies and FEniCSx
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
  software-properties-common \
14
  build-essential \
 
27
  && apt-get install -y fenicsx \
28
  && rm -rf /var/lib/apt/lists/*
29
 
30
+ # Python virtual environment
31
  RUN python3.10 -m venv /opt/venv
 
 
32
  ENV PATH="/opt/venv/bin:$PATH"
33
 
34
+ # Upgrade pip and install FEniCSx bindings
35
+ RUN pip install --upgrade pip && pip install fenics-dolfinx mpi4py
36
 
37
  # Verify FEniCSx installation
38
  RUN python -c "import dolfinx; print('FEniCSx version:', dolfinx.__version__)"
39
 
40
+ # Install Python dependencies
 
 
 
 
 
 
41
  COPY requirements.txt /tmp/requirements.txt
 
 
42
  RUN pip install --no-cache-dir -r /tmp/requirements.txt
43
+ RUN pip install --no-cache-dir gradio[oauth]==5.9.1 "uvicorn>=0.14.0" spaces
44
 
45
+ # Optional: Freeze installed packages
46
+ RUN pip freeze > /tmp/freeze.txt
 
 
 
47
 
48
+ # Set working directory
49
+ WORKDIR /home/user/app
50
 
51
+ # Copy application code
52
  COPY --chown=1000:1000 ./ /home/user/app
53
 
54
+ # Expose application port
 
 
 
55
  EXPOSE 7860
56
 
57
+ # Define the default command
58
  CMD ["python3.10", "app.py"]