forked from gamosoft/NoteDiscovery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (32 loc) · 1.29 KB
/
Dockerfile
File metadata and controls
43 lines (32 loc) · 1.29 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
# Stage 1: Install dependencies
FROM python:3.11-slim AS builder
WORKDIR /app
# Install Python packages
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --prefix=/install -r requirements.txt && \
# Clean up unnecessary files to reduce image size
find /install -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true && \
find /install -type f -name "*.pyc" -delete && \
find /install -type d -name "tests" -exec rm -rf {} + 2>/dev/null || true && \
find /install -type d -name "*.dist-info" -exec rm -rf {}/RECORD {} + 2>/dev/null || true
# Stage 2: Final minimal image
FROM python:3.11-slim
WORKDIR /app
# Copy only installed packages (no pip cache, no build artifacts)
COPY --from=builder /install /usr/local
# Copy application files
COPY backend ./backend
COPY frontend ./frontend
COPY config.yaml .
COPY plugins ./plugins
COPY themes ./themes
# Create data directories
RUN mkdir -p data/notes data/search_index
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=60s --timeout=3s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"
# Run the application
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]