From 9755bd87b2d8d6263e3743045c274dbe2fcbee37 Mon Sep 17 00:00:00 2001 From: SBCrumb Date: Tue, 9 Sep 2025 15:18:58 -0400 Subject: [PATCH] push to registry --- .gitea/workflows/ci.yml | 16 +++---- example-distribution-README.md | 51 +++++++++++++++++++++ example-docker-compose.yml | 38 ++++++++++++++++ example-multi-registry-workflow.yml | 70 +++++++++++++++++++++++++++++ 4 files changed, 166 insertions(+), 9 deletions(-) create mode 100644 example-distribution-README.md create mode 100644 example-docker-compose.yml create mode 100644 example-multi-registry-workflow.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 611f0ea..b0d7198 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -42,18 +42,16 @@ jobs: echo "Building Docker image..." docker build -t nfoguard:latest . docker tag nfoguard:latest nfoguard:${{ github.sha }} + docker tag nfoguard:latest gitea.skalas.org/jskala/nfoguard:latest + docker tag nfoguard:latest gitea.skalas.org/jskala/nfoguard:${{ github.sha }} echo "Docker image built successfully" - - name: Push to registry (if main branch) - if: github.ref == 'refs/heads/main' + - name: Push to Gitea registry run: | - echo "Pushing Docker image to registry..." - # Add your registry push commands here - # Examples: - # docker tag nfoguard:latest your-registry.com/nfoguard:latest - # docker push your-registry.com/nfoguard:latest - # docker push your-registry.com/nfoguard:${{ github.sha }} - echo "Image ready for deployment" + echo "Pushing to Gitea container registry..." + docker push gitea.skalas.org/jskala/nfoguard:latest + docker push gitea.skalas.org/jskala/nfoguard:${{ github.sha }} + echo "Images pushed successfully" deploy: needs: build diff --git a/example-distribution-README.md b/example-distribution-README.md new file mode 100644 index 0000000..ed281f2 --- /dev/null +++ b/example-distribution-README.md @@ -0,0 +1,51 @@ +# NFOguard - Easy Deployment + +[![Docker Pulls](https://img.shields.io/docker/pulls/jskala/nfoguard)](https://hub.docker.com/r/jskala/nfoguard) +[![GitHub Release](https://img.shields.io/github/v/release/jskala/NFOguard)](https://github.com/jskala/NFOguard/releases) + +Latest Version: v1.0.0 + +## Quick Start + +```bash +# Download the example files +curl -o docker-compose.yml https://raw.githubusercontent.com/jskala/NFOguard-Deploy/main/docker-compose.yml +curl -o .env https://raw.githubusercontent.com/jskala/NFOguard-Deploy/main/.env.example + +# Edit your .env file +nano .env + +# Start the service +docker-compose up -d +``` + +## Available Images + +- **GitHub Container Registry**: `ghcr.io/jskala/nfoguard:latest` +- **Docker Hub**: `jskala/nfoguard:latest` + +## Configuration + +See the [.env.example](./.env.example) file for all available configuration options. + +## Docker Compose + +The [docker-compose.yml](./docker-compose.yml) includes: +- NFOguard service +- PostgreSQL database (optional) +- Volume mounts for data persistence +- Health checks +- Restart policies + +## Updates + +To update to the latest version: + +```bash +docker-compose pull +docker-compose up -d +``` + +## Source Code + +The source code is available at: https://github.com/jskala/NFOguard \ No newline at end of file diff --git a/example-docker-compose.yml b/example-docker-compose.yml new file mode 100644 index 0000000..98dc713 --- /dev/null +++ b/example-docker-compose.yml @@ -0,0 +1,38 @@ +version: '3.8' + +services: + nfoguard: + image: ghcr.io/jskala/nfoguard:latest + container_name: nfoguard + restart: unless-stopped + ports: + - "8080:8080" + environment: + - PUID=${PUID:-1000} + - PGID=${PGID:-1000} + - TZ=${TZ:-UTC} + volumes: + - ./data:/app/data + - ./config:/app/config + - ${MEDIA_PATH}:/media:ro + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + + # Optional: PostgreSQL database + # postgres: + # image: postgres:15 + # container_name: nfoguard-db + # restart: unless-stopped + # environment: + # POSTGRES_DB: nfoguard + # POSTGRES_USER: ${DB_USER:-nfoguard} + # POSTGRES_PASSWORD: ${DB_PASSWORD} + # volumes: + # - postgres_data:/var/lib/postgresql/data + +# volumes: +# postgres_data: \ No newline at end of file diff --git a/example-multi-registry-workflow.yml b/example-multi-registry-workflow.yml new file mode 100644 index 0000000..f4ec2cb --- /dev/null +++ b/example-multi-registry-workflow.yml @@ -0,0 +1,70 @@ +name: Build & Deploy + +on: + push: + branches: [ main ] + tags: [ 'v*' ] + +jobs: + build-and-push: + runs-on: host + + steps: + - name: Checkout code + run: | + rm -rf * .git* 2>/dev/null || true + git clone https://gitea.skalas.org/jskala/NFOguard.git /tmp/repo + cp -r /tmp/repo/* . + cp -r /tmp/repo/.* . 2>/dev/null || true + rm -rf /tmp/repo + + - name: Set up variables + run: | + # Get version from tag or use 'latest' + if [[ ${{ github.ref }} == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + else + VERSION=latest + fi + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "Building version: $VERSION" + + - name: Build Docker image + run: | + docker build -t nfoguard:${{ env.VERSION }} . + docker tag nfoguard:${{ env.VERSION }} nfoguard:latest + + - name: Push to GitHub Container Registry + run: | + echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin + docker tag nfoguard:${{ env.VERSION }} ghcr.io/jskala/nfoguard:${{ env.VERSION }} + docker tag nfoguard:${{ env.VERSION }} ghcr.io/jskala/nfoguard:latest + docker push ghcr.io/jskala/nfoguard:${{ env.VERSION }} + docker push ghcr.io/jskala/nfoguard:latest + + - name: Push to Docker Hub + run: | + echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin + docker tag nfoguard:${{ env.VERSION }} jskala/nfoguard:${{ env.VERSION }} + docker tag nfoguard:${{ env.VERSION }} jskala/nfoguard:latest + docker push jskala/nfoguard:${{ env.VERSION }} + docker push jskala/nfoguard:latest + + - name: Update distribution repo + run: | + # Clone the distribution repo + git clone https://github.com/jskala/NFOguard-Deploy.git /tmp/deploy + cd /tmp/deploy + + # Update docker-compose.yml with new version + sed -i "s|image: .*nfoguard:.*|image: ghcr.io/jskala/nfoguard:${{ env.VERSION }}|" docker-compose.yml + + # Update README with new version info + sed -i "s/Latest Version: .*/Latest Version: ${{ env.VERSION }}/" README.md + + # Commit and push changes + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git add . + git commit -m "Update to version ${{ env.VERSION }}" || exit 0 + git push \ No newline at end of file