-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (41 loc) · 1.64 KB
/
Dockerfile
File metadata and controls
54 lines (41 loc) · 1.64 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
# Reproducible container build for OptiConn.
# This image intentionally does NOT bundle third-party executables like DSI Studio.
# All Python dependencies are downloaded during `docker build`.
ARG PYTHON_IMAGE=python:3.10.12-slim
FROM ${PYTHON_IMAGE} AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /opt/opticonn
# System packages: keep minimal; wheels cover most scientific deps, but build tools help when a wheel isn't available.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
git \
&& rm -rf /var/lib/apt/lists/*
# Install the Python package (non-editable) for a clean, reviewable environment.
# Copy only what is needed for installation first to maximize Docker cache reuse.
COPY pyproject.toml README.md LICENSE opticonn.py ./
COPY scripts ./scripts
COPY constraints.txt ./constraints.txt
ARG INSTALL_DEV=0
RUN python -m pip install --upgrade pip setuptools wheel \
&& if [ "$INSTALL_DEV" = "1" ]; then \
python -m pip install --constraint /opt/opticonn/constraints.txt ".[dev]"; \
else \
python -m pip install --constraint /opt/opticonn/constraints.txt .; \
fi
FROM base AS runtime
# Include default configuration files so basic validation can run inside the image.
COPY configs ./configs
# Default to the CLI entrypoint.
ENTRYPOINT ["opticonn"]
CMD ["--help"]
FROM base AS docs
# Docs are a separate target so the runtime image stays minimal.
COPY mkdocs.yml ./mkdocs.yml
COPY docs ./docs
RUN python -m pip install -r docs/requirements.txt
EXPOSE 8000
CMD ["python", "-m", "mkdocs", "serve", "-a", "0.0.0.0:8000"]