-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (48 loc) · 2.2 KB
/
Copy pathDockerfile
File metadata and controls
61 lines (48 loc) · 2.2 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
# NullOrigin — Universal AI Provenance & Watermark Sanitization Middleware
# Author: Muhammad Rakibul Islam <imrakibul@gmail.com>
# License: Apache-2.0
#
# Builds on both Apple Silicon (linux/arm64) and x86_64 (linux/amd64).
FROM python:3.11-slim AS base
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /app
# Runtime libraries for Pillow, SciPy, and PyWavelets. build-essential is
# needed only if a wheel is unavailable for the target architecture.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libjpeg62-turbo \
zlib1g \
libopenblas0 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Dependency layer. The whole project must be present before `pip install .`
# runs: pyproject declares `readme = "README.md"` and an explicit package list,
# so installing from pyproject.toml alone fails at metadata generation.
COPY pyproject.toml README.md LICENSE ./
COPY nullorigin ./nullorigin
RUN pip install --no-cache-dir .
COPY nullorigin.yaml ./
# Run as a non-root user; the proxy needs no elevated privileges.
RUN useradd --create-home --shell /usr/sbin/nologin nullorigin \
&& chown -R nullorigin:nullorigin /app
USER nullorigin
EXPOSE 8080
# Inside Compose the model server is a sibling service, not localhost.
ENV NULLORIGIN_CONFIG=/app/nullorigin.yaml \
NULLORIGIN_OLLAMA_ENDPOINT=http://ollama:11434
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -fsS http://127.0.0.1:8080/health || exit 1
ENTRYPOINT ["nullorigin"]
# --allow-public-bind is required and correct here. Binding 0.0.0.0 inside a
# container means "every interface in this container's network namespace",
# which is the only way published ports work. The isolation boundary is the
# namespace plus whatever you choose to publish, not the bind address.
#
# It does NOT make the proxy safe to expose directly: there is still no TLS and
# no request authentication. Set NULLORIGIN_TELEMETRY_TOKEN and put a
# TLS-terminating reverse proxy in front before publishing this beyond a
# trusted network.
CMD ["run", "--host", "0.0.0.0", "--port", "8080", "--allow-public-bind"]