feat(readme): update Docker badge to reflect new deployment workflow.

This commit is contained in:
shay
2026-04-18 00:52:46 -04:00
parent 19a357d92b
commit 873ca512bd
5 changed files with 120 additions and 6 deletions
@@ -1,4 +1,4 @@
name: docker
name: build and deploy
on:
push:
@@ -11,7 +11,7 @@ env:
jobs:
build:
name: ${{ matrix.service }}
name: build ${{ matrix.service }}
runs-on: ubuntu-latest
permissions:
contents: read
@@ -20,6 +20,8 @@ jobs:
fail-fast: false
matrix:
service: [fetcher, generator, edge]
outputs:
image_tag: ${{ steps.tag.outputs.value }}
steps:
- uses: actions/checkout@v4
@@ -33,6 +35,12 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute image tag (sha-<short>)
id: tag
env:
SHA: ${{ github.sha }}
run: echo "value=sha-${SHA:0:7}" >> "$GITHUB_OUTPUT"
- name: Compute image name (lowercase)
id: img
env:
@@ -46,8 +54,7 @@ jobs:
with:
images: ${{ steps.img.outputs.name }}
tags: |
type=ref,event=branch
type=sha,format=short
type=raw,value=${{ steps.tag.outputs.value }}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build ${{ matrix.service }} image
@@ -59,3 +66,18 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.service }}
cache-to: type=gha,mode=max,scope=${{ matrix.service }}
deploy:
name: deploy to mini PC
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: [self-hosted, minipc]
steps:
- uses: actions/checkout@v4
- name: Deploy compose stack
env:
IMAGE_TAG: ${{ needs.build.outputs.image_tag }}
GITHUB_PAT: ${{ secrets.FETCHER_GITHUB_PAT }}
FETCHER_INTERNAL_TOKEN: ${{ secrets.FETCHER_INTERNAL_TOKEN }}
run: ./deploy/deploy.sh
+1 -1
View File
@@ -1,7 +1,7 @@
# github-readme-stats
[![tests](https://github.com/ShayManor/github-readme-stats/actions/workflows/tests.yml/badge.svg)](https://github.com/ShayManor/github-readme-stats/actions/workflows/tests.yml)
[![docker](https://github.com/ShayManor/github-readme-stats/actions/workflows/docker.yml/badge.svg)](https://github.com/ShayManor/github-readme-stats/actions/workflows/docker.yml)
[![build and deploy](https://github.com/ShayManor/github-readme-stats/actions/workflows/deploy.yml/badge.svg)](https://github.com/ShayManor/github-readme-stats/actions/workflows/deploy.yml)
A monorepo of three independent Python services plus a React frontend,
each self-contained. See each service's README for details.
+78
View File
@@ -0,0 +1,78 @@
name: ghstats
services:
fetcher:
image: ghcr.io/shaymanor/ghstats-fetcher:${IMAGE_TAG:-latest}
container_name: ghstats-fetcher
restart: unless-stopped
environment:
GITHUB_PAT: ${GITHUB_PAT:?missing GITHUB_PAT}
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
volumes:
- ${HOME}/ghstats/data/fetcher:/app/data
ports:
- "127.0.0.1:5001:5001"
fetcher-cron:
image: ghcr.io/shaymanor/ghstats-fetcher:${IMAGE_TAG:-latest}
container_name: ghstats-fetcher-cron
restart: unless-stopped
command: ["python", "-m", "src.cron"]
environment:
GITHUB_PAT: ${GITHUB_PAT:?missing GITHUB_PAT}
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
volumes:
- ${HOME}/ghstats/data/fetcher:/app/data
depends_on:
- fetcher
generator:
image: ghcr.io/shaymanor/ghstats-generator:${IMAGE_TAG:-latest}
container_name: ghstats-generator
restart: unless-stopped
environment:
FETCHER_URL: http://fetcher:5001
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
volumes:
- ${HOME}/ghstats/data/generator:/app/data
ports:
- "5002:5002"
depends_on:
- fetcher
generator-worker:
image: ghcr.io/shaymanor/ghstats-generator:${IMAGE_TAG:-latest}
container_name: ghstats-generator-worker
restart: unless-stopped
command: ["python", "-m", "src.worker"]
environment:
FETCHER_URL: http://fetcher:5001
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
volumes:
- ${HOME}/ghstats/data/generator:/app/data
depends_on:
- generator
generator-cron:
image: ghcr.io/shaymanor/ghstats-generator:${IMAGE_TAG:-latest}
container_name: ghstats-generator-cron
restart: unless-stopped
command: ["python", "-m", "src.cron"]
environment:
FETCHER_URL: http://fetcher:5001
FETCHER_INTERNAL_TOKEN: ${FETCHER_INTERNAL_TOKEN:?missing FETCHER_INTERNAL_TOKEN}
volumes:
- ${HOME}/ghstats/data/generator:/app/data
depends_on:
- generator
edge:
image: ghcr.io/shaymanor/ghstats-edge:${IMAGE_TAG:-latest}
container_name: ghstats-edge
restart: unless-stopped
environment:
GENERATOR_URL: http://generator:5002
ports:
- "5003:5003"
depends_on:
- generator
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Pulls the current image tag and brings up the compose stack.
# Expects GITHUB_PAT, FETCHER_INTERNAL_TOKEN, and IMAGE_TAG to be present in
# the environment (exported by the GitHub Actions deploy job).
set -euo pipefail
cd "$(dirname "$0")"
mkdir -p "$HOME/ghstats/data/fetcher" "$HOME/ghstats/data/generator"
docker compose pull
docker compose up -d --remove-orphans
docker compose ps
+2 -1
View File
@@ -6,4 +6,5 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY src ./src
EXPOSE 5003
CMD ["gunicorn", "-b", "0.0.0.0:5003", "-w", "2", "src.api:app"]
# Bind to $PORT when set (e.g. Cloud Run injects PORT=8080); default to 5003.
CMD ["sh", "-c", "exec gunicorn -b 0.0.0.0:${PORT:-5003} -w 2 src.api:app"]