Skip to content

Commit a390899

Browse files
committed
chore: rename Dockerfile.new → Dockerfile (multi-stage build)
1 parent 234e372 commit a390899

3 files changed

Lines changed: 57 additions & 57 deletions

File tree

Dockerfile

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
1-
FROM python:3.12-slim
1+
# ── Stage 1: Build React UI ────────────────────────────────────────────────────
2+
FROM --platform=$BUILDPLATFORM node:20-bookworm-slim AS ui-builder
3+
WORKDIR /ui
4+
COPY frontend/omnibioai-model-registry-ui/package*.json ./
5+
RUN npm ci
6+
COPY frontend/omnibioai-model-registry-ui/ ./
7+
RUN npm run build
28

3-
WORKDIR /app
4-
5-
ENV PYTHONDONTWRITEBYTECODE=1
6-
ENV PYTHONUNBUFFERED=1
9+
# ── Stage 2: Python API + nginx ───────────────────────────────────────────────
10+
FROM python:3.12-slim-bookworm AS backend
11+
LABEL org.opencontainers.image.source=https://github.com/man4ish/omnibioai
712

8-
# Install deps
9-
COPY pyproject.toml /app/pyproject.toml
10-
RUN pip install --no-cache-dir -U pip && \
11-
pip install --no-cache-dir .
13+
RUN apt-get update && apt-get install -y --no-install-recommends \
14+
nginx && rm -rf /var/lib/apt/lists/*
1215

13-
# Copy package (non-src layout)
14-
COPY omnibioai_model_registry /app/omnibioai_model_registry
15-
16-
ENV HOST=0.0.0.0
17-
ENV PORT=8095
16+
WORKDIR /app
17+
COPY pyproject.toml .
18+
RUN pip install --no-cache-dir -U pip && pip install --no-cache-dir .
19+
COPY omnibioai_model_registry/ ./omnibioai_model_registry/
20+
21+
COPY --from=ui-builder /ui/dist /usr/share/nginx/html
22+
23+
RUN printf 'server {\n\
24+
listen 5176;\n\
25+
root /usr/share/nginx/html;\n\
26+
index index.html;\n\
27+
location /_svc/modelregistry/ { alias /usr/share/nginx/html/; try_files $uri $uri/ /_svc/modelregistry/index.html; }\n\
28+
location / { try_files $uri $uri/ /index.html; }\n\
29+
location /v1/ { proxy_pass http://127.0.0.1:8095; proxy_set_header Host $host; }\n\
30+
location /health { proxy_pass http://127.0.0.1:8095; }\n\
31+
location /docs { proxy_pass http://127.0.0.1:8095; }\n\
32+
}\n' > /etc/nginx/sites-available/default
33+
34+
ENV HOST=0.0.0.0 PORT=8095 PYTHONUNBUFFERED=1
1835
ENV MODEL_REGISTRY_APP=omnibioai_model_registry.service.app.main:app
19-
20-
EXPOSE 8095
21-
22-
CMD ["python", "-m", "uvicorn", "omnibioai_model_registry.service.app.main:app", "--host", "0.0.0.0", "--port", "8095"]
23-
24-
36+
EXPOSE 8095 5176
37+
CMD ["bash", "-c", "nginx && python -m uvicorn omnibioai_model_registry.service.app.main:app --host 0.0.0.0 --port 8095"]

Dockerfile.legacy

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM python:3.12-slim
2+
3+
WORKDIR /app
4+
5+
ENV PYTHONDONTWRITEBYTECODE=1
6+
ENV PYTHONUNBUFFERED=1
7+
8+
# Install deps
9+
COPY pyproject.toml /app/pyproject.toml
10+
RUN pip install --no-cache-dir -U pip && \
11+
pip install --no-cache-dir .
12+
13+
# Copy package (non-src layout)
14+
COPY omnibioai_model_registry /app/omnibioai_model_registry
15+
16+
ENV HOST=0.0.0.0
17+
ENV PORT=8095
18+
ENV MODEL_REGISTRY_APP=omnibioai_model_registry.service.app.main:app
19+
20+
EXPOSE 8095
21+
22+
CMD ["python", "-m", "uvicorn", "omnibioai_model_registry.service.app.main:app", "--host", "0.0.0.0", "--port", "8095"]
23+
24+

Dockerfile.new

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)