-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
49 lines (30 loc) · 1 KB
/
Dockerfile
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
# Install Python dependencies
FROM python:3.13.0-bookworm AS python-base
ENV LC_CTYPE=C.utf8 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONFAULTHANDLER=1 \
UV_PROJECT_ENVIRONMENT="/app/.venv" \
UV_PYTHON_INSTALL_DIR="/python" \
UV_COMPILE_BYTECODE=1
WORKDIR /app
# Install uv
COPY --from=ghcr.io/astral-sh/uv:0.4 /uv /usr/local/bin/uv
# Install Python dependencies
COPY ./pyproject.toml ./uv.lock /app/
RUN uv sync --frozen --no-dev --no-install-project
ENV PATH="/app/.venv/bin:$PATH"
# Download NLTK files
FROM python-base AS nltk-corpora
COPY ./nltk.txt /app/
RUN xargs -I{} python -c "import nltk; nltk.download('{}')" < /app/nltk.txt
# Build static assets
FROM python-base AS staticfiles
COPY . /app
RUN python manage.py tailwind build && \
python manage.py collectstatic --no-input
FROM python-base AS webapp
COPY --from=nltk-corpora /root/nltk_data /root/nltk_data
COPY --from=staticfiles /app/staticfiles /app/staticfiles
COPY . /app