diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 4b6e7ac..249144d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -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 }} diff --git a/Dockerfile b/Dockerfile index e770b54..199efe8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 + 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 -# Final stage - minimal runtime image +# 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 @@ -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 diff --git a/README.md b/README.md index 7d406b1..07fb4b0 100644 --- a/README.md +++ b/README.md @@ -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)