Merge pull request #64 from hazre/ci/add-docker-image-builds

ci: add docker image workflow
This commit is contained in:
7w1 authored and GitHub committed 2026-03-02 16:58:03 -06:00
commit faf71a09f8
2 files changed
+111 -1

No files matched your search

+76
View File
@@ -0,0 +1,76 @@
name: Build and publish Docker image
on:
push:
branches: [dev]
tags:
- '+([0-9]).+([0-9]).+([0-9])'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
artifact-metadata: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Log in to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
# dev branch: short commit SHA + latest
type=sha,prefix=,format=short,enable=${{ github.ref == 'refs/heads/dev' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/dev' }}
# git tags: semver breakdown
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Build and push Docker image
id: push
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
+35 -1
View File
@@ -12,7 +12,41 @@ The web app is available at [app.sable.moe](https://app.sable.moe/) and gets upd
You can also download our desktop app for windows and linux from [releases](https://github.com/7w1/sable/releases/latest).
## Self-hosting
To host Sable on your own, download this repo and built with nginx.
You can either run the prebuilt container image or build Sable yourself.
### Docker
Prebuilt images are published to `ghcr.io/7w1/sable`.
- `latest` tracks the current `dev` branch image.
- `X.Y.Z` tags are versioned releases.
- `X.Y` tags float within a release line.
- Pushes to `dev` also publish a short commit SHA tag.
Run the latest image with:
```sh
docker run --rm -p 8080:80 ghcr.io/7w1/sable:latest
```
Then open `http://localhost:8080`.
If you want to override the bundled [`config.json`](config.json), mount your own
file at `/app/config.json`:
```yaml
services:
sable:
image: ghcr.io/7w1/sable:latest
ports:
- '8080:80'
volumes:
- ./config.json:/app/config.json:ro
```
### Build it yourself
To build and serve Sable yourself with nginx, clone this repo and build it:
```sh
npm ci # Installs all dependencies