From 4f76572f761712d7011d38200a7b6e3ac557f970 Mon Sep 17 00:00:00 2001 From: Gamosoft Date: Thu, 6 Nov 2025 11:29:59 +0100 Subject: [PATCH] Added container publication --- .github/workflows/docker-publish.yml | 67 ++++++++++++++++++++++++++++ README.md | 60 ++++++++++++++++++++++++- docker-compose.ghcr.yml | 25 +++++++++++ 3 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docker-publish.yml create mode 100644 docker-compose.ghcr.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..7d9c738 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,67 @@ +name: Build and Push Docker Image to GHCR + +on: + push: + branches: + - main + - master + tags: + - 'v*.*.*' + pull_request: + branches: + - main + - master + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push Docker image + id: build-push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Image digest + run: echo "Image pushed with digest ${{ steps.build-push.outputs.digest }}" + diff --git a/README.md b/README.md index af9d785..59528fd 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,65 @@ NoteDiscovery is a **lightweight, self-hosted note-taking application** that put ## 🚀 Quick Start -### Running with Docker (Recommended) +### Running from GitHub Container Registry (Easiest & Recommended) + +Use the pre-built image directly from GHCR - no building required! + +**Option 1: Docker Compose (Recommended)** + +```bash +# Download the docker-compose file +curl -O https://raw.githubusercontent.com/gamosoft/notediscovery/main/docker-compose.ghcr.yml + +# Or if you cloned the repo, just use it directly +docker-compose -f docker-compose.ghcr.yml up -d + +# Access at http://localhost:8000 + +# View logs +docker-compose -f docker-compose.ghcr.yml logs -f + +# Stop the application +docker-compose -f docker-compose.ghcr.yml down +``` + +**Option 2: Docker Run (Alternative)** + +```bash +# Linux/macOS +docker run -d \ + --name notediscovery \ + -p 8000:8000 \ + -v $(pwd)/data:/app/data \ + -v $(pwd)/plugins:/app/plugins \ + -v $(pwd)/themes:/app/themes \ + -v $(pwd)/config.yaml:/app/config.yaml \ + --restart unless-stopped \ + ghcr.io/gamosoft/notediscovery:latest +``` + +```powershell +# Windows PowerShell +docker run -d ` + --name notediscovery ` + -p 8000:8000 ` + -v ${PWD}/data:/app/data ` + -v ${PWD}/plugins:/app/plugins ` + -v ${PWD}/themes:/app/themes ` + -v ${PWD}/config.yaml:/app/config.yaml ` + --restart unless-stopped ` + ghcr.io/gamosoft/notediscovery:latest +``` + +Access at http://localhost:8000 + +**Why use the GHCR image?** +- ✅ No build time - instant deployment +- ✅ Always up-to-date with the latest release +- ✅ Tested and verified builds +- ✅ Smaller download with optimized layers + +### Running with Docker Compose (Recommended for Development) Docker ensures consistent environment and easy deployment: diff --git a/docker-compose.ghcr.yml b/docker-compose.ghcr.yml new file mode 100644 index 0000000..507e87c --- /dev/null +++ b/docker-compose.ghcr.yml @@ -0,0 +1,25 @@ +services: + notediscovery: + image: ghcr.io/gamosoft/notediscovery:latest + container_name: notediscovery + ports: + - "8000:8000" + volumes: + # Persist notes and data (inside 'notes' folder) + - ./data:/app/data + # Custom plugins + - ./plugins:/app/plugins + # Custom themes + - ./themes:/app/themes + # Custom config (optional) + - ./config.yaml:/app/config.yaml + restart: unless-stopped + environment: + - TZ=UTC + healthcheck: + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] + interval: 60s + timeout: 3s + retries: 3 + start_period: 5s +