Skip to content

Commit 07ad67f

Browse files
committed
Docker reproducibility
1 parent da3ea5d commit 07ad67f

File tree

4 files changed

+107
-383
lines changed

4 files changed

+107
-383
lines changed

Dockerfile

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,35 @@
1-
# BioAnalyzer Backend Dockerfile
21
FROM python:3.11-slim
32

43
WORKDIR /app
5-
6-
# FIX: Make Python recognize the application as a package
74
ENV PYTHONPATH="/app:/app/app"
85

9-
# Install system dependencies
106
RUN apt-get update && apt-get install -y \
11-
gcc \
12-
g++ \
13-
curl \
14-
git \
7+
gcc g++ curl git \
158
&& rm -rf /var/lib/apt/lists/*
169

17-
# Copy pyproject.toml and README.md first for better caching
1810
COPY pyproject.toml README.md ./
1911

20-
# Upgrade pip and setuptools first
2112
RUN pip install --upgrade pip setuptools wheel build
2213

23-
# ------------------------------------------------------------
24-
# Step 1: Install PyTorch CPU versions (fixed +cpu issue)
25-
# Note: PyTorch CPU versions require special index URL, so we install them separately
26-
# before installing the package from pyproject.toml
27-
# ------------------------------------------------------------
28-
RUN pip install --no-cache-dir --default-timeout=600 --retries=10 \
29-
--extra-index-url https://download.pytorch.org/whl/cpu \
30-
torch==2.1.0+cpu \
31-
torchvision==0.16.0+cpu \
32-
torchaudio==2.1.0+cpu
14+
# Install PyTorch CPU wheels
15+
RUN pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu \
16+
torch==2.1.0+cpu torchvision==0.16.0+cpu torchaudio==2.1.0+cpu
3317

34-
# ------------------------------------------------------------
35-
# Step 2: Copy application code
36-
# ------------------------------------------------------------
3718
COPY . .
3819

39-
# ------------------------------------------------------------
40-
# Step 3: Install the package from pyproject.toml
41-
# This installs the package and all its dependencies from pyproject.toml
42-
# PyTorch is already installed above, so pip will skip it
43-
# Installing in editable mode (-e) ensures entry points are properly installed
44-
# ------------------------------------------------------------
45-
RUN pip install --no-cache-dir --default-timeout=300 --retries=5 -e .
20+
# Install package + dependencies
21+
RUN pip install --no-cache-dir -e .
4622

47-
# ------------------------------------------------------------
48-
# Step 4: Install testing dependencies (optional, for development)
49-
# ------------------------------------------------------------
50-
RUN pip install --no-cache-dir pytest>=7.4.0 pytest-cov>=4.1.0
23+
# Explicit analysis deps (defensive)
24+
RUN pip install --no-cache-dir pandas scikit-learn matplotlib seaborn
5125

52-
# Create necessary directories
5326
RUN mkdir -p cache logs results
5427

55-
# Make CLI executable
56-
RUN chmod +x cli.py
28+
RUN chmod +x cli.py || true
29+
RUN chmod +x scripts/*.py || true
5730

58-
# Expose port
5931
EXPOSE 8000
6032

61-
# Health check
62-
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
63-
CMD curl -f http://localhost:8000/health || exit 1
64-
65-
# Set PYTHONPATH for app module imports (fixed nested /app/app issue)
66-
# ENV PYTHONPATH=/app:/app/app
33+
HEALTHCHECK CMD curl -f http://localhost:8000/health || exit 1
6734

68-
# Default command (can be overridden)
6935
CMD ["python", "main.py", "--host", "0.0.0.0", "--port", "8000"]

config/requirements.txt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ torchaudio>=2.1.0+cpu
1010
numpy>=1.26.0
1111
pandas>=2.1.1
1212
scikit-learn>=1.3.0
13-
matplotlib>=3.7
14-
seaborn>=0.12
13+
matplotlib>=3.7.0
14+
seaborn>=0.12.0
1515
biopython>=1.81
1616
pytz>=2023.3
1717

@@ -29,7 +29,7 @@ paper-qa>=5.0.0
2929
# --- Vector Database ---
3030
qdrant-client>=1.7.0
3131

32-
# --- Web Framework & API (FastAPI/Uvicorn) ---
32+
# --- Web Framework & API ---
3333
fastapi>=0.104.0
3434
uvicorn[standard]>=0.23.2
3535
starlette>=0.31.1
@@ -47,19 +47,15 @@ wsproto>=1.0.0
4747
h11>=0.12.0
4848
httptools>=0.3.0
4949

50-
# --- File Processing (Excel/Env) ---
50+
# --- File Processing ---
5151
openpyxl>=3.1.0
5252
xlrd>=2.0.1
5353
python-dotenv>=1.0.0
5454
PyYAML>=5.4.1
5555
aiofiles>=0.7.0
5656

57-
# --- Utilities & System ---
58-
tqdm>=4.65.0`
57+
# --- Utilities ---
58+
tqdm>=4.65.0
5959
psutil>=5.9.0
6060
click>=8.0.1
6161
watchfiles[watchdog]>=1.0.0
62-
63-
# --- Development (Uncomment to install) ---
64-
# pytest>=7.4.0
65-
# pytest-cov>=4.1.0

0 commit comments

Comments
 (0)