-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdockerfile
More file actions
47 lines (39 loc) · 1.37 KB
/
dockerfile
File metadata and controls
47 lines (39 loc) · 1.37 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
# syntax=docker/dockerfile:1.7
############################
# Builder stage
############################
FROM python:3.11-slim AS builder
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
WORKDIR /src
# Minimal toolchain (keep if you may add C extensions later)
RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm -rf /var/lib/apt/lists/*
# Build from source at this commit
COPY pyproject.toml MANIFEST.in README.md ./
COPY clematis ./clematis
COPY scripts ./scripts
RUN --mount=type=cache,target=/root/.cache/pip \
python -m pip install --upgrade pip build && \
python -m build --wheel && \
ls -l dist
############################
# Runtime stage
############################
FROM python:3.11-slim
LABEL org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY:-vecipher/Clematis3}"
# Non-root user
RUN useradd -m -u 10001 appuser
WORKDIR /app
# Provide repo-local configs; ensure imports resolve
COPY configs ./configs
ENV PYTHONPATH=/app:$PYTHONPATH
# Offline-by-default runtime
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONUNBUFFERED=1 \
CLEMATIS_NETWORK_BAN=1
# Install wheel built in builder stage
COPY --from=builder /src/dist/*.whl /tmp/
RUN python -m pip install --no-cache-dir /tmp/*.whl && \
rm -rf /root/.cache/pip /tmp/*.whl
USER appuser
ENTRYPOINT ["clematis"]
CMD ["--help"]