-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (37 loc) · 1.73 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (37 loc) · 1.73 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
# ==============================================================================
# Enterprise Multi-Stage Dockerfile for ML From Scratch Engine
# ==============================================================================
# Build Stage
FROM python:3.12-slim AS builder
WORKDIR /build
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
COPY pyproject.toml .
RUN pip install --no-cache-dir --prefix=/install .
# Production Stage
FROM python:3.12-slim AS runtime
LABEL org.opencontainers.image.title="ml-from-scratch-engine" \
org.opencontainers.image.description="Enterprise Machine Learning From Scratch Suite: Autograd, Transformer, VectorDB, BPE, MinHash, Guardrails" \
org.opencontainers.image.authors="cibi-dev" \
org.opencontainers.image.vendor="Machine Learning Systems" \
org.opencontainers.image.licenses="MIT"
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH="/app:/app/packages/autograd-engine:/app/packages/bpe-tokenizer:/app/packages/guardrails-engine:/app/packages/minhash-dedup:/app/packages/nano-transformer:/app/packages/numpy-vectordb"
# Copy installed dependencies from builder
COPY --from=builder /install /usr/local
# Create non-root user for DevSecOps compliance
RUN groupadd -r mle && useradd -r -g mle -u 1001 -m -d /app mle_user
# Copy application files
COPY --chown=mle_user:mle cli.py pyproject.toml README.md ./
COPY --chown=mle_user:mle packages/ ./packages/
COPY --chown=mle_user:mle benchmarks/ ./benchmarks/
USER mle_user
ENTRYPOINT ["python3", "/app/cli.py"]
CMD ["demo"]