-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (48 loc) · 1.79 KB
/
Dockerfile
File metadata and controls
66 lines (48 loc) · 1.79 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
# =============================================================================
# Stage 1: Build SvelteKit frontend
# =============================================================================
FROM node:22-alpine AS frontend
WORKDIR /build/web
COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web/ ./
RUN npm run build
# =============================================================================
# Stage 2: Python application
# =============================================================================
FROM python:3.12-slim AS runtime
ARG INSTALL_SEMANTIC=true
WORKDIR /app
# System deps for building Python packages
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Install pyrite with server + ai extras
COPY pyproject.toml README.md ./
COPY pyrite/ pyrite/
COPY extensions/ extensions/
RUN pip install --no-cache-dir ".[server,ai,cli]" && \
if [ "$INSTALL_SEMANTIC" = "true" ]; then \
pip install --no-cache-dir ".[semantic]"; \
fi
# Remove build deps to slim the image
RUN apt-get purge -y build-essential gcc && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# Copy built frontend from stage 1
COPY --from=frontend /build/web/dist/ /app/web/dist/
# Copy deploy scripts (for seeding etc.)
COPY deploy/ /app/deploy/
# Create non-root user
RUN useradd --create-home --shell /bin/bash pyrite
# Data directory for volumes
ENV PYRITE_DATA_DIR=/data
ENV PYRITE_STATIC_DIR=/app/web/dist
RUN mkdir -p /data && chown pyrite:pyrite /data
VOLUME /data
USER pyrite
EXPOSE 8088
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8088/health')" || exit 1
CMD ["pyrite-server"]