forked from cheshire-cat-ai/core
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (60 loc) · 2.11 KB
/
Dockerfile
File metadata and controls
73 lines (60 loc) · 2.11 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
62
63
64
65
66
67
68
69
70
71
72
73
FROM python:3.13-slim-bullseye AS builder
### ENVIRONMENT VARIABLES ###
ENV PYTHONUNBUFFERED=1 \
UV_NO_CACHE=1 \
UV_LINK_MODE=copy \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1
### SYSTEM SETUP ###
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
build-essential \
libmagic1 \
libmagic-dev \
poppler-utils \
tesseract-ocr \
libgl1 \
mime-support && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
### PREPARE BUILD WITH NECESSARY FILES AND FOLDERS ###
WORKDIR /app
COPY ./pyproject.toml ./uv.lock ./LICENSE ./
COPY ./cat/core_plugins ./cat/core_plugins
### INSTALL DEPENDENCIES (CORE + CORE PLUGINS) ###
RUN pip install -U pip uv && \
uv sync --frozen --no-install-project --no-upgrade --no-cache --no-dev --python /usr/local/bin/python3.13 && \
find ./cat/core_plugins -name requirements.txt | sed 's/^/-r /' | xargs uv pip install --no-cache --no-upgrade && \
rm -rf *.egg-info /root/.cache/pip /tmp/* /var/tmp/* && \
uv cache clean && \
find ./ -type d -name __pycache__ -exec rm -rf {} +
# ──────────────────────────────────────────────
FROM python:3.13-slim-bullseye AS final
ENV PYTHONUNBUFFERED=1 \
UV_NO_CACHE=1 \
UV_LINK_MODE=copy \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libmagic1 \
poppler-utils \
tesseract-ocr \
libgl1 \
mime-support && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.13 /usr/local/lib/python3.13
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /app /app
COPY ./cat ./cat
COPY ./data ./data
COPY ./migrations ./migrations
### SETUP ENTRYPOINT ###
COPY ./docker/entrypoint.sh ./docker/entrypoint.sh
RUN chmod +x ./docker/entrypoint.sh
ENTRYPOINT ["./docker/entrypoint.sh"]
CMD ["python", "-m", "cat.main"]