Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64 #,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
34 changes: 12 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
# Build stage - compile dependencies
# Stage 1: Install dependencies
FROM python:3.11-slim AS builder

WORKDIR /app

# Install build dependencies (only in this stage)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libssl-dev \
libffi-dev \
python3-dev \
cargo \
rustc \
&& rm -rf /var/lib/apt/lists/*

# Install Python dependencies
# Install Python packages
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --prefix=/install -r requirements.txt

# Final stage - minimal runtime image
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

# Install only runtime dependencies (not build tools!)
RUN apt-get update && apt-get install -y --no-install-recommends \
libssl3 \
&& rm -rf /var/lib/apt/lists/*

# Copy installed Python packages from builder
# Copy only installed packages (no pip cache, no build artifacts)
COPY --from=builder /install /usr/local

# Copy application files
Expand All @@ -45,7 +35,7 @@ RUN mkdir -p data/notes data/search_index
EXPOSE 8000

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
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
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ NoteDiscovery is a **lightweight, self-hosted note-taking application** that put
Use the pre-built image directly from GHCR - no building required!

> **💡 Tip**: Always use `ghcr.io/gamosoft/notediscovery:latest` to get the newest features and fixes. Images are automatically built when PRs are merged to main.
>
> **🖥️ Multi-Architecture Support**: Images are built for `x86_64`, `ARM64` (Raspberry Pi 3/4/5), and `ARM v7` (older Raspberry Pi models). Docker will automatically pull the correct version for your device.

> **📁 Important - Volume Mapping**: The container needs local folders/files to work:
> - **Required**: `data` folder (your notes will be stored here)
Expand Down