-
Notifications
You must be signed in to change notification settings - Fork 0
183 lines (156 loc) · 5.61 KB
/
docker.yml
File metadata and controls
183 lines (156 loc) · 5.61 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Build and push Docker images
on:
push:
tags:
- "beebuzz@*"
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/lucor/beebuzz
GOVULNCHECK_VERSION: v1.1.4
STATICCHECK_VERSION: v0.7.0
jobs:
test-server:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ['1.25', '1.26']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ matrix.go-version }}
check-latest: true
- name: Run govulncheck
if: matrix.go-version == '1.26'
run: |
go install golang.org/x/vuln/cmd/govulncheck@${{ env.GOVULNCHECK_VERSION }}
govulncheck ./...
- name: Run staticcheck
if: matrix.go-version == '1.26'
run: |
go install honnef.co/go/tools/cmd/staticcheck@${{ env.STATICCHECK_VERSION }}
staticcheck ./...
- name: Run Go tests
run: go test ./...
test-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.31.0
run_install: false
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: web/package.json
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml
- name: Install web dependencies
run: pnpm install --frozen-lockfile
working-directory: web
- name: Audit production dependencies
run: pnpm audit --prod
working-directory: web
- name: Run web check
run: pnpm run check
working-directory: web
- name: Run web lint
run: pnpm run lint
working-directory: web
- name: Run web tests
run: pnpm run test
working-directory: web
build-server:
needs: test-server
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> "$GITHUB_ENV"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Log in to GHCR
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push server image
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
context: .
file: deploy/server.Dockerfile
push: true
pull: true
platforms: linux/amd64
build-args: COMMIT_SHA=${{ github.sha }}
cache-from: type=gha,scope=server
cache-to: type=gha,mode=max,scope=server
tags: |
${{ env.IMAGE }}:server
${{ env.IMAGE }}:server-${{ env.SHORT_SHA }}
build-web:
needs: test-web
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> "$GITHUB_ENV"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Log in to GHCR
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push web image
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
context: .
file: deploy/web.Dockerfile
push: true
pull: true
platforms: linux/amd64
build-args: |
VITE_BEEBUZZ_DOMAIN=${{ vars.BEEBUZZ_DOMAIN }}
VITE_BEEBUZZ_DEBUG=${{ vars.VITE_BEEBUZZ_DEBUG }}
VITE_BEEBUZZ_DEPLOYMENT_MODE=${{ vars.VITE_BEEBUZZ_DEPLOYMENT_MODE }}
cache-from: type=gha,scope=web
cache-to: type=gha,mode=max,scope=web
tags: |
${{ env.IMAGE }}:web
${{ env.IMAGE }}:web-${{ env.SHORT_SHA }}
deploy-server:
needs: build-server
runs-on: ubuntu-latest
steps:
- name: Trigger Dokploy server deploy
run: |
curl -fSs -o /dev/null -w "HTTP %{http_code}" \
-X POST "${{ secrets.DOKPLOY_URL }}/api/application.deploy" \
-H "x-api-key: ${{ secrets.DOKPLOY_API_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"applicationId\": \"${{ secrets.DOKPLOY_SERVER_APP_ID }}\", \"title\": \"${{ github.ref_name }}\"}"
deploy-web:
needs: build-web
runs-on: ubuntu-latest
steps:
- name: Trigger Dokploy web deploy
run: |
curl -fSs -o /dev/null -w "HTTP %{http_code}" \
-X POST "${{ secrets.DOKPLOY_URL }}/api/application.deploy" \
-H "x-api-key: ${{ secrets.DOKPLOY_API_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"applicationId\": \"${{ secrets.DOKPLOY_WEB_APP_ID }}\", \"title\": \"${{ github.ref_name }}\"}"