Add GHCR publish workflow and pre-built image deployment

Adds a GitHub Actions workflow that builds and pushes backend and nginx
images to GitHub Container Registry on every merge to main and on
releases. Adds docker-compose.ghcr.yml for end users who want to deploy
without cloning the repo, and updates the README with Quick Deploy
instructions alongside the existing build-from-source guide.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2GT-Rich
2026-04-19 10:21:21 -07:00
co-authored by Claude Sonnet 4.6
parent 5d96503832
commit 25ae3854b4
3 changed files with 261 additions and 1 deletions
+100
View File
@@ -0,0 +1,100 @@
name: Publish to GHCR
on:
push:
branches:
- main
release:
types: [published]
env:
REGISTRY: ghcr.io
BACKEND_IMAGE: ghcr.io/2gt-media-group-llc/mikrotik-manager-backend
NGINX_IMAGE: ghcr.io/2gt-media-group-llc/mikrotik-manager-nginx
jobs:
publish-backend:
name: Build & Push Backend
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.BACKEND_IMAGE }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-,format=short
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./backend
dockerfile: backend/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
publish-nginx:
name: Build & Push Nginx (Frontend)
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.NGINX_IMAGE }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-,format=short
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
dockerfile: nginx/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
+43 -1
View File
@@ -206,7 +206,49 @@ Instant search across devices, clients, and events from the top navigation bar.
---
## Quick Start
## Quick Deploy (Pre-built Images)
No source code or build toolchain required — just Docker and Docker Compose.
### 1. Download the compose file
```bash
curl -O https://raw.githubusercontent.com/2GT-Media-Group-LLC/mikrotik-manager/main/docker-compose.ghcr.yml
```
### 2. Create your environment file
```bash
curl -O https://raw.githubusercontent.com/2GT-Media-Group-LLC/mikrotik-manager/main/.env.example
mv .env.example .env
```
Edit `.env` and set at minimum:
```env
JWT_SECRET=your_long_random_jwt_secret_here
ENCRYPTION_KEY=your_32_character_encryption_key_
```
### 3. Start the application
```bash
docker compose -f docker-compose.ghcr.yml up -d
```
Docker pulls the pre-built images from GitHub Container Registry and starts the stack. No compilation, no cloning.
### 4. Open the app
Navigate to **https://localhost** (or your server's IP/hostname) and log in with `admin` / `admin`.
> To update to the latest release: `docker compose -f docker-compose.ghcr.yml pull && docker compose -f docker-compose.ghcr.yml up -d`
---
## Quick Start (Build from Source)
For contributors or anyone who wants to build the images locally.
### 1. Clone the repository
+118
View File
@@ -0,0 +1,118 @@
version: '3.8'
# Pre-built image deployment — no source code or build toolchain required.
# For development/build-from-source, use docker-compose.yml instead.
services:
nginx:
image: ghcr.io/2gt-media-group-llc/mikrotik-manager-nginx:latest
ports:
- "${HTTP_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
volumes:
- certs_data:/certs
depends_on:
backend:
condition: service_healthy
restart: unless-stopped
networks:
- app-network
backend:
image: ghcr.io/2gt-media-group-llc/mikrotik-manager-backend:latest
environment:
NODE_ENV: production
DATABASE_URL: postgresql://mikrotik:${DB_PASSWORD:-mikrotik_secure_pw}@postgres:5432/mikrotik_manager
REDIS_URL: redis://redis:6379
INFLUXDB_URL: http://influxdb:8086
INFLUXDB_TOKEN: ${INFLUXDB_TOKEN:-mytoken123456789}
INFLUXDB_ORG: ${INFLUXDB_ORG:-mikrotik-manager}
INFLUXDB_BUCKET: ${INFLUXDB_BUCKET:-metrics}
JWT_SECRET: ${JWT_SECRET:-changeme_use_a_long_random_secret}
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-changeme32byteslongencryptionkey}
PORT: 3001
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
influxdb:
condition: service_healthy
volumes:
- backups_data:/app/backups
- certs_data:/certs
cap_add:
- NET_RAW
restart: unless-stopped
networks:
- app-network
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3001/api/health"]
interval: 15s
timeout: 10s
retries: 5
start_period: 30s
postgres:
image: postgres:15-alpine
environment:
POSTGRES_DB: mikrotik_manager
POSTGRES_USER: mikrotik
POSTGRES_PASSWORD: ${DB_PASSWORD:-mikrotik_secure_pw}
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U mikrotik -d mikrotik_manager"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
redis:
image: redis:7-alpine
command: redis-server --appendonly yes
volumes:
- redis_data:/data
restart: unless-stopped
networks:
- app-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
influxdb:
image: influxdb:2.7
environment:
DOCKER_INFLUXDB_INIT_MODE: setup
DOCKER_INFLUXDB_INIT_USERNAME: admin
DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUXDB_ADMIN_PASSWORD:-admin_password_123}
DOCKER_INFLUXDB_INIT_ORG: ${INFLUXDB_ORG:-mikrotik-manager}
DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUXDB_BUCKET:-metrics}
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_TOKEN:-mytoken123456789}
volumes:
- influxdb_data:/var/lib/influxdb2
restart: unless-stopped
networks:
- app-network
healthcheck:
test: ["CMD", "influx", "ping"]
interval: 15s
timeout: 10s
retries: 10
start_period: 30s
volumes:
postgres_data:
redis_data:
influxdb_data:
backups_data:
certs_data:
networks:
app-network:
driver: bridge