-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (38 loc) · 1.26 KB
/
Dockerfile
File metadata and controls
50 lines (38 loc) · 1.26 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
# Stage 1: Build frontend
FROM node:20-slim AS frontend-build
WORKDIR /build
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
# Stage 2: Install Python dependencies
FROM python:3.11-slim AS python-build
WORKDIR /build
COPY backend/pyproject.toml backend/README.md ./
COPY backend/ungula/ ./ungula/
RUN pip install --no-cache-dir --prefix=/install .
# Stage 3: Final image
FROM python:3.11-slim
# Create non-root user
RUN groupadd -r ungula && useradd -r -g ungula -m ungula
# Copy installed Python packages and CLI
COPY --from=python-build /install /usr/local
# Copy application source
WORKDIR /app
COPY backend/ungula/ ./ungula/
# Copy frontend dist
COPY --from=frontend-build /build/dist ./frontend/dist
# Copy workspace templates
COPY docs/templates/ ./docs/templates/
# Data volume — create and own before switching user
ENV UNGULA_HOME=/data
ENV UNGULA_DOCKER=1
RUN mkdir -p /data && chown ungula:ungula /data
VOLUME ["/data"]
# Switch to non-root user
USER ungula
EXPOSE 8001
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import httpx; r = httpx.get('http://localhost:8001/api/health', timeout=5); r.raise_for_status()" || exit 1
CMD ["ungula", "start"]