-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
142 lines (131 loc) · 3.52 KB
/
docker-compose.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
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
# =============================================================================
# Docker Compose file for testing on Go versions 1.15 to the latest.
# =============================================================================
# It is recommended to run specifying a specific service and not at once.
#
# - Recommended usage:
# - To update go.mod:
# $ docker compose run tidy
#
# - To unit test:
# $ docker compose run v1_22
# $ docker compose run latest
#
# - To check lint and static analysis:
# $ docker compose run lint
#
# - To check critical vulnerabilities:
# $ docker compose run vuln
#
# - NOT recommended:
# $ docker compose up
#
# Since the service `tidy` will update/re-write the "go.mod" file to the latest
# module version, during it's process the "go.mod" file will be gone temporarily.
# Thus, `docker compose up` will cause failure in the other container because of
# missing "go.mod" file.
# =============================================================================
volumes:
GO_PKG_MOD:
services:
# Service tidy updates the go.mod to the latest
tidy:
build:
context: .
dockerfile: ./.github/Dockerfile
args:
VARIANT: 1.22-alpine
volumes:
- .:/workspaces
entrypoint: [ "./.github/run_go_mod_tidy.sh" ]
# Run latest golangci-lint
lint:
image: golangci/golangci-lint:latest
working_dir: /workspaces
volumes:
- .:/workspaces
- GO_PKG_MOD:/go/pkg/mod
entrypoint: golangci-lint run ./...
# Run latest govulncheck (vulnerability scanner)
vuln:
build:
context: .
dockerfile: ./.github/Dockerfile
args:
VARIANT: alpine
GOINSTALL: golang.org/x/vuln/cmd/govulncheck@latest
working_dir: /workspaces
volumes:
- .:/workspaces
- GO_PKG_MOD:/go/pkg/mod
entrypoint: [ "govulncheck", "./..." ]
# # Service v1_15 runs the tests on Go v1.15
# v1_15:
# build:
# context: .
# dockerfile: ./.github/Dockerfile
# args:
# VARIANT: 1.15-alpine
# volumes:
# - .:/workspaces
# - GO_PKG_MOD:/go/pkg/mod
# # Service v1_16 runs the tests on Go v1.16
# v1_16:
# build:
# context: .
# dockerfile: ./.github/Dockerfile
# args:
# VARIANT: 1.16-alpine
# volumes:
# - .:/workspaces
# - GO_PKG_MOD:/go/pkg/mod
# # Service v1_17 runs the tests on Go v1.17
# v1_17:
# build:
# context: .
# dockerfile: ./.github/Dockerfile
# args:
# VARIANT: 1.17-alpine
# volumes:
# - .:/workspaces
# - GO_PKG_MOD:/go/pkg/mod
# # Service v1_18 runs the tests on Go v1.18
# v1_18:
# build:
# context: .
# dockerfile: ./.github/Dockerfile
# args:
# VARIANT: 1.18-alpine
# volumes:
# - .:/workspaces
# - GO_PKG_MOD:/go/pkg/mod
# # Service v1_19 runs the tests on Go v1.19
# v1_19:
# build:
# context: .
# dockerfile: ./.github/Dockerfile
# args:
# VARIANT: 1.19-alpine
# volumes:
# - .:/workspaces
# - GO_PKG_MOD:/go/pkg/mod
# Service v1_22 is the minimum version we support
v1_22:
build:
context: .
dockerfile: ./.github/Dockerfile
args:
VARIANT: 1.22-alpine
volumes:
- .:/workspaces
- GO_PKG_MOD:/go/pkg/mod
# Service latest runs the tests on latest Go docker image
latest:
build:
context: .
dockerfile: ./.github/Dockerfile
args:
VARIANT: alpine
volumes:
- .:/workspaces
- GO_PKG_MOD:/go/pkg/mod