Skip to content

Commit 9b53cd9

Browse files
committed
Publish multi-platform image to GHCR
Add GitHub Actions workflow to build and publish a multi-platform container image to GHCR (linux/amd64, linux/arm64, linux/arm/v7) with latest and immutable sha-<commit> tags (.github/workflows/docker.yml). Update compose.yaml to pull the published image (ghcr.io/bi119ate5hxk/sunray2server:latest) and set pull_policy: always, and add compose.build.yaml to allow local-build overlay for development. Update README with usage details (pulling, deploying a specific SHA tag, GHCR auth, and how to use the compose build overlay).
1 parent b2febff commit 9b53cd9

4 files changed

Lines changed: 96 additions & 7 deletions

File tree

.github/workflows/docker.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Publish container image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: container-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
IMAGE_NAME: ghcr.io/bi119ate5hxk/sunray2server
15+
16+
jobs:
17+
publish:
18+
name: Build and publish
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
steps:
25+
- name: Check out repository
26+
uses: actions/checkout@v6
27+
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v4
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v4
33+
34+
- name: Log in to GitHub Container Registry
35+
uses: docker/login-action@v4
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Generate image metadata
42+
id: meta
43+
uses: docker/metadata-action@v6
44+
with:
45+
images: ${{ env.IMAGE_NAME }}
46+
tags: |
47+
type=raw,value=latest
48+
type=sha,format=long,prefix=sha-
49+
50+
- name: Build and publish image
51+
uses: docker/build-push-action@v7
52+
with:
53+
context: .
54+
platforms: linux/amd64,linux/arm64,linux/arm/v7
55+
push: true
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}
58+
cache-from: type=gha
59+
cache-to: type=gha,mode=max

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,32 @@ Linux Docker host:
407407
```sh
408408
cp config.yaml.template config.yaml
409409
# Edit config.yaml for the remote target and routing.
410-
SUNRAY_CONFIG=./config.yaml docker compose up --build
410+
SUNRAY_CONFIG=./config.yaml docker compose up
411+
```
412+
413+
The default Compose file pulls
414+
`ghcr.io/bi119ate5hxk/sunray2server:latest`. Every push to `main` publishes a
415+
new multi-platform image for `linux/amd64`, `linux/arm64`, and `linux/arm/v7`,
416+
plus an immutable `sha-<full-commit-sha>` tag. To deploy a particular revision,
417+
set `image` in `compose.yaml` to that SHA tag. The workflow can also be run
418+
manually from the GitHub Actions page.
419+
420+
GHCR must allow the deployment host to read the package. Public packages can
421+
be pulled anonymously; for a private package, run `docker login ghcr.io` before
422+
starting Compose. After a new `main` build succeeds, recreate with the latest
423+
published image:
424+
425+
```sh
426+
docker compose pull
427+
SUNRAY_CONFIG=./config.yaml docker compose up
428+
```
429+
430+
For local development, overlay the build file so Compose builds the current
431+
checkout instead of pulling GHCR:
432+
433+
```sh
434+
SUNRAY_CONFIG=./config.yaml \
435+
docker compose -f compose.yaml -f compose.build.yaml up --build
411436
```
412437

413438
For simple local testing, set `password` directly on each VNC session in
@@ -424,7 +449,7 @@ Point Compose at that source file when starting it:
424449
```sh
425450
SUNRAY_CONFIG=./config.yaml \
426451
SUNRAY_VNC_PASSWORD_FILE=/absolute/path/to/vnc_password \
427-
docker compose up --build
452+
docker compose up
428453
```
429454

430455
Compose mounts the password read-only as `/run/secrets/vnc_password`. The image
@@ -446,7 +471,7 @@ Desktop restarts, recreate the container:
446471

447472
```sh
448473
docker compose down
449-
SUNRAY_CONFIG=./config.yaml docker compose up --build
474+
SUNRAY_CONFIG=./config.yaml docker compose up
450475
```
451476

452477
Confirm from the Mac that the authentication listener is reachable:

compose.build.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
sunrayd:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
image: sunray2server:local
7+
pull_policy: build

compose.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
services:
22
sunrayd:
3-
build:
4-
context: .
5-
dockerfile: Dockerfile
6-
image: sunray2server:local
3+
image: ghcr.io/bi119ate5hxk/sunray2server:latest
4+
pull_policy: always
75
# Required for the Sun Ray's TCP control channel and dynamic bidirectional
86
# UDP display channel. On Docker Desktop, first enable host networking in
97
# Settings > Resources > Network, then Apply & Restart.

0 commit comments

Comments
 (0)