-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (56 loc) · 2.35 KB
/
Dockerfile
File metadata and controls
66 lines (56 loc) · 2.35 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
61
62
63
64
65
66
# ModelSEED API — Docker build
#
# Expects all dependency repos cloned as siblings (see README):
# modelseed/
# modelseed-api/ (this repo)
# ModelSEEDpy/ (cshenry fork, main branch)
# KBUtilLib/ (cshenry, main branch)
# cobrakbase/ (Fxe/cobrakbase, master branch — 0.4.0+)
# ModelSEEDDatabase/ (dev branch)
# ModelSEEDTemplates/
# cb_annotation_ontology_api/
#
# Build: cd modelseed && docker compose -f modelseed-api/docker-compose.yml up --build
FROM python:3.11-slim
# System deps for cobra (GLPK solver), compilation, and git
RUN apt-get update && apt-get install -y --no-install-recommends \
glpk-utils \
libglpk-dev \
libexpat1 \
gcc \
g++ \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy dependency repos (cloned as siblings of modelseed-api)
COPY cobrakbase /deps/cobrakbase
COPY ModelSEEDpy /deps/ModelSEEDpy
COPY KBUtilLib /deps/KBUtilLib
COPY ModelSEEDDatabase /deps/ModelSEEDDatabase
COPY ModelSEEDTemplates /deps/ModelSEEDTemplates
COPY cb_annotation_ontology_api /deps/cb_annotation_ontology_api
# Install all Python dependencies from local repos.
# Order matters: cobrakbase first (no deps on others), then ModelSEEDpy, then KBUtilLib.
# All three are installed as editable so container uses the exact cloned versions.
RUN pip install --no-cache-dir -e /deps/cobrakbase && \
pip install --no-cache-dir -e /deps/ModelSEEDpy && \
pip install --no-cache-dir -e /deps/KBUtilLib
# Copy and install modelseed-api
COPY modelseed-api/src/ /app/src/
COPY modelseed-api/data/ /app/data/
COPY modelseed-api/pyproject.toml /app/
RUN pip install --no-cache-dir -e ".[modeling]"
# Environment configuration
ENV MODELSEED_MODELSEED_DB_PATH=/deps/ModelSEEDDatabase
ENV MODELSEED_TEMPLATES_PATH=/deps/ModelSEEDTemplates/templates/v7.0
ENV MODELSEED_CB_ANNOTATION_ONTOLOGY_API_PATH=/deps/cb_annotation_ontology_api
ENV MODELSEED_JOB_STORE_DIR=/tmp/modelseed-jobs
ENV MODELSEED_HOST=0.0.0.0
ENV MODELSEED_PORT=8000
# WORKAROUND: cobrakbase.KBaseAPI() reads token from ~/.kbase/token file.
# Required by MSReconstructionUtils init even when not using KBase.
ENV KB_AUTH_TOKEN=unused
RUN mkdir -p /root/.kbase && echo "unused" > /root/.kbase/token
EXPOSE 8000
WORKDIR /app/src
CMD ["python", "-m", "uvicorn", "modelseed_api.main:app", "--host", "0.0.0.0", "--port", "8000"]