Publish prebuilt Docker images to GHCR
GitHub Actions builds and pushes multi-arch (amd64/arm64) api/web images to ghcr.io on every push to main and on version tags, so self-hosters can 'docker compose pull' instead of building from source. compose.yml keeps both image: and build: so building locally still works via --build.
This commit is contained in:
1 parent
4c2b6344f7
commit
8e20c2c304
5 files changed
+83
-2
No files matched your search
@@ -0,0 +1,59 @@
|
||||
name: Publish Docker images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- image: api
|
||||
context: ./api
|
||||
file: ./api/Dockerfile
|
||||
- image: web
|
||||
context: .
|
||||
file: ./web/Dockerfile
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Lowercase owner (registry names must be lowercase)
|
||||
id: repo
|
||||
run: echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ steps.repo.outputs.owner }}/opengym-${{ matrix.image }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
|
||||
- uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ${{ matrix.context }}
|
||||
file: ${{ matrix.file }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha,scope=${{ matrix.image }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.image }}
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- 🐳 Prebuilt Docker images published to `ghcr.io/duartesantos8/opengym-{api,web}` (amd64 + arm64)
|
||||
via GitHub Actions, so self-hosting no longer requires building from source. `docker compose pull`
|
||||
grabs them; `docker compose up -d --build` still builds locally if you'd rather.
|
||||
- 🔔 Push notifications: rest-timer-over alert (fires even if the app is closed) and an optional
|
||||
daily reminder on days you have a workout planned but haven't logged one yet. Opt in per-profile
|
||||
in Settings — requires a signed-in passkey profile. Backend gains one dependency (`web-push`);
|
||||
|
||||
@@ -65,12 +65,14 @@ You need [Docker](https://docs.docker.com/get-docker/) with Compose.
|
||||
git clone https://github.com/DuarteSantos8/openGym
|
||||
cd openGym
|
||||
cp .env.example .env
|
||||
docker compose pull # grab prebuilt images (amd64 + arm64) — skip to build from source instead
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Open **http://localhost:8080**, tap **Create profile**, and you're in. First launch downloads
|
||||
the exercise media (~140 MB) once and builds the app inside Docker — you don't need Node or a
|
||||
build step locally.
|
||||
the exercise media (~140 MB) once. Prefer building the images yourself instead of pulling from
|
||||
`ghcr.io`? Drop the `pull` step and run `docker compose up -d --build` — you don't need Node or
|
||||
a build step locally either way.
|
||||
|
||||
> Want it reachable from your phone over the internet with passkeys? You'll need an HTTPS
|
||||
> domain — a two-line change in `.env`. See **[docs/SELF_HOSTING.md](docs/SELF_HOSTING.md)**.
|
||||
|
||||
@@ -22,7 +22,9 @@ services:
|
||||
restart: "no"
|
||||
|
||||
# Passkey auth + per-user data (Node, no framework).
|
||||
# image: prebuilt (docker compose pull). build: from source (docker compose up --build).
|
||||
api:
|
||||
image: ghcr.io/duartesantos8/opengym-api:latest
|
||||
build: ./api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
@@ -35,6 +37,7 @@ services:
|
||||
# Builds the React frontend (multi-stage) and serves it, proxying /api → api
|
||||
# and the exercise media from the shared volume. Single origin for passkeys.
|
||||
web:
|
||||
image: ghcr.io/duartesantos8/opengym-web:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: web/Dockerfile
|
||||
|
||||
@@ -11,11 +11,14 @@ Requirements: [Docker](https://docs.docker.com/get-docker/) with the Compose plu
|
||||
git clone https://github.com/DuarteSantos8/gym-app opengym
|
||||
cd opengym
|
||||
cp .env.example .env
|
||||
docker compose pull # prebuilt images from ghcr.io (amd64 + arm64) — or skip and build from source
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
- First start downloads the exercise images/GIFs (~140 MB) once into `app/img` and `app/gif`.
|
||||
- Open **http://localhost:8080** and create a profile with a passkey.
|
||||
- Rather build from source than pull prebuilt images? Skip `docker compose pull` and run
|
||||
`docker compose up -d --build` instead — no Node needed locally either way.
|
||||
|
||||
Check it's healthy:
|
||||
|
||||
@@ -117,6 +120,16 @@ TZ=Europe/Zurich
|
||||
|
||||
## 7. Updating
|
||||
|
||||
Running prebuilt images:
|
||||
|
||||
```bash
|
||||
git pull # picks up compose/config changes
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Building from source instead:
|
||||
|
||||
```bash
|
||||
git pull
|
||||
docker compose up -d --build
|
||||
@@ -136,3 +149,4 @@ downloaded media are untouched.
|
||||
| No "Notifications" option in Settings | Requires a signed-in profile and HTTPS (or `localhost`) — guest mode and plain HTTP over LAN can't subscribe. |
|
||||
| Day reminder fires at the wrong time | Set `TZ=Continent/City` in `.env` and restart (see section 6). Defaults to UTC. |
|
||||
| Want to reset a stuck login | Delete the cookie in your browser; sessions are just signed cookies. |
|
||||
| `docker compose pull` fails with "denied" / "unauthorized" | The prebuilt images aren't published yet, or need to be, or the GHCR package is still private — build from source instead (`docker compose up -d --build`). |
|
||||
Reference in new issue
Block a user