-
-
Notifications
You must be signed in to change notification settings - Fork 159
96 lines (89 loc) · 2.67 KB
/
build-docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Build Docker development container
on:
push:
branches:
- master
- "build-docker"
tags:
- '*'
- '!v*'
workflow_dispatch:
jobs:
signalk-server_npm_files:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Node setup
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Build npm files locally and upload artifacts
run: |
npm cache clean -f
npm install npm@latest -g
npm install --package-lock-only
npm ci && npm cache clean --force
npm run build --workspaces --if-present
cd packages/server-admin-ui
npm pack && mv *.tgz ../../
cd ../server-api
npm pack && mv *.tgz ../../
cd ../streams
npm pack && mv *.tgz ../../
cd ../resources-provider-plugin
npm pack && mv *.tgz ../../
cd ../..
jq '.workspaces=[]' package.json > _package.json && mv _package.json package.json
npm i --save *.tgz
npm run build
npm pack
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: packed-modules
path: |
*.tgz
build_docker_images:
runs-on: ubuntu-latest
needs: [signalk-server_npm_files]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: |
signalk/signalk-server
ghcr.io/signalk/signalk-server
tags: |
type=ref,event=branch
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: signalkci
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }} # Personal access tokens (classic) with a scope of "write:packages" is needed to release ghcr.io package registry.
- uses: actions/download-artifact@v3
with:
name: packed-modules
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}