-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (48 loc) · 2.14 KB
/
Copy pathDockerfile
File metadata and controls
60 lines (48 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Use an official Python runtime as a parent image
# Using Python 3.11.14 as specifically requested
FROM python:3.11.14-slim
# Set environment variables
# Prevents Python from writing pyc files to disc
ENV PYTHONDONTWRITEBYTECODE=1
# Prevents Python from buffering stdout and stderr
ENV PYTHONUNBUFFERED=1
# Set R_HOME for rpy2 compatibility
ENV R_HOME=/usr/lib/R
# Install system dependencies
# R is required for the mclust-based domain identification
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
r-base \
r-base-dev \
libxml2-dev \
libssl-dev \
libcurl4-openssl-dev \
git \
&& rm -rf /var/lib/apt/lists/*
# Install R package 'mclust'
# This is used by the rpy2 interface in spmetatme.utils.utils
RUN R -e "install.packages('mclust', repos='http://cran.rstudio.com/')"
# Set the working directory in the container
WORKDIR /app
# Copy the dependency files first to leverage Docker cache
COPY requirements.txt .
COPY pyproject.toml .
# Install PyTorch and PyTorch Geometric with specified versions
# These versions match the installation guide in README.md for CUDA 12.6
# We install these FIRST to ensure they are the ones used by subsequent libraries
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cu126 && \
pip install --no-cache-dir pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.7.0+cu126.html && \
pip install --no-cache-dir torch_geometric
# Install other Python dependencies from requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the entire project to the container
COPY . .
# Install the package in standard mode to ensure it's copied to site-packages
RUN pip install --no-cache-dir .
# (Optional) Pre-download the metabolic models or other resources if possible
# RUN python -c "from spmetatme.data.Download import get_model_path; get_model_path('breast_cancer')"
# Default command to run the CLI
ENTRYPOINT ["spmetatme"]
# Default argument for the entrypoint
CMD ["--help"]