Added container publication

This commit is contained in:
Gamosoft 2025-11-06 11:29:59 +01:00
parent db5264eccb
commit 4f76572f76
3 changed files with 151 additions and 1 deletions

67
.github/workflows/docker-publish.yml vendored Normal file
View File

@ -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 }}"

View File

@ -41,7 +41,65 @@ NoteDiscovery is a **lightweight, self-hosted note-taking application** that put
## 🚀 Quick Start ## 🚀 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: Docker ensures consistent environment and easy deployment:

25
docker-compose.ghcr.yml Normal file
View File

@ -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