Repository navigation
166 lines (142 loc) · 4.59 KB
/
Copy pathdocker.yml
File metadata and controls
166 lines (142 loc) · 4.59 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
name: "Docker"
on:
workflow_dispatch:
push:
schedule:
- cron: "0 8 * * 1"
permissions:
contents: read
jobs:
lint:
name: "Test"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: go vet
run: go vet ./...
- name: go test
run: go test -race ./...
- name: staticcheck
uses: dominikh/staticcheck-action@v1
with:
install-go: false
# v0.8.1 (latest release) can't read go1.27.2 export data ("export
# data version 5 is greater than maximum supported version 4").
# Pinned to a master commit verified against go1.27.2; switch
# back to a release tag once one newer than v0.8.1 ships.
version: "452d5bb86b45"
- name: govulncheck
run: go run golang.org/x/vuln/cmd/govulncheck@latest ./...
- name: shellcheck
run: shellcheck .docker/viewdoc.sh
- name: hadolint
run: |
for f in Dockerfile .docker/kasm/Dockerfile .docker/webtop/Dockerfile; do
echo "::group::$f"
docker run --rm -i -v "$PWD/.hadolint.yaml:/.config/hadolint.yaml:ro" hadolint/hadolint < "$f"
echo "::endgroup::"
done
test:
name: "Test image (${{ matrix.variant }})"
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- variant: control-center
dockerfile: Dockerfile
- variant: viewer-kasm
dockerfile: .docker/kasm/Dockerfile
- variant: viewer-webtop
dockerfile: .docker/webtop/Dockerfile
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build image for testing
uses: docker/build-push-action@v7
with:
context: .
file: ${{ matrix.dockerfile }}
push: false
tags: dockette/viewdoc:${{ matrix.variant }}-test
platforms: linux/amd64
load: true
build:
name: "Build (${{ matrix.variant }})"
needs: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- variant: control-center
dockerfile: Dockerfile
- variant: viewer-kasm
dockerfile: .docker/kasm/Dockerfile
- variant: viewer-webtop
dockerfile: .docker/webtop/Dockerfile
steps:
- name: Checkout
uses: actions/checkout@v7
# Only a push needs credentials; pull requests from forks and Dependabot
# have no access to the secrets (same as dockette/.github docker.yml).
- name: Login to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Read VERSION
id: version
run: . ./VERSION && echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
# One build, two tags per variant: <variant> and <variant>-<date>
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
file: ${{ matrix.dockerfile }}
push: ${{ github.ref == 'refs/heads/master' }}
tags: |
dockette/viewdoc:${{ matrix.variant }}
dockette/viewdoc:${{ matrix.variant }}-${{ steps.version.outputs.version }}
build-args: |
VERSION=${{ steps.version.outputs.version }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=${{ matrix.variant }}
cache-to: type=gha,scope=${{ matrix.variant }}
release:
name: "Release"
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
. ./VERSION
gh release view "$VERSION" || gh release create "$VERSION" --generate-notes
docs:
name: "Docs"
needs: build
if: github.ref == 'refs/heads/master'
uses: dockette/.github/.github/workflows/dockerhub-description.yml@master
secrets: inherit
with:
image: "dockette/viewdoc"