Skip to content

Commit 8b4ac66

Browse files
committed
Refactor Docker workflow and compose for ARM64 image build and deployment
1 parent 7d56a77 commit 8b4ac66

2 files changed

Lines changed: 44 additions & 14 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,58 @@ on:
1111
# Then a new version will be deployed on the self-hosted runner.
1212

1313
jobs:
14-
rpi4:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Build ARM64 image
24+
uses: docker/build-push-action@v5
25+
with:
26+
context: .
27+
file: ./HomeSpeaker.Server2/Dockerfile
28+
platforms: linux/arm64
29+
tags: homespeakerserver2:latest
30+
outputs: type=docker,dest=/tmp/homespeaker-arm64.tar
31+
cache-from: type=gha
32+
cache-to: type=gha,mode=max
33+
34+
- name: Upload image artifact
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: homespeaker-arm64-image
38+
path: /tmp/homespeaker-arm64.tar
39+
retention-days: 1
40+
41+
deploy:
42+
needs: build
1543
runs-on: [self-hosted, "${{ matrix.runner}}" ]
1644
strategy:
1745
matrix:
1846
runner: [rpi4, rpi42]
1947

2048
steps:
21-
- uses: actions/checkout@v3
22-
23-
- name: Docker compose pull
24-
run: docker-compose pull
25-
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
52+
- name: Download image artifact
53+
uses: actions/download-artifact@v4
54+
with:
55+
name: homespeaker-arm64-image
56+
path: /tmp/
57+
58+
- name: Load Docker image
59+
run: docker load < /tmp/homespeaker-arm64.tar
60+
2661
- name: Docker compose down
2762
run: docker-compose down
2863

2964
- name: Docker compose up
3065
env:
31-
COMPOSE_DOCKER_CLI_BUILD: 1
32-
DOCKER_BUILDKIT: 1
3366
GOVEE_API_KEY: ${{ secrets.GOVEE_API_KEY }}
34-
run: docker-compose up -d --build --remove-orphans
67+
run: docker-compose up -d --remove-orphans
3568

docker-compose.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ version: '3.4'
22
services:
33
homespeaker.server2:
44
container_name: homespeaker
5-
image: homespeakerserver2
6-
build:
7-
context: .
8-
dockerfile: HomeSpeaker.Server2/Dockerfile
5+
image: homespeakerserver2:latest
96
restart: unless-stopped
107
devices:
118
- /dev/snd:/dev/snd
@@ -45,4 +42,4 @@ services:
4542
speakernet:
4643

4744
networks:
48-
speakernet:
45+
speakernet:

0 commit comments

Comments
 (0)