This repository has been archived by the owner on Dec 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
/
docker-compose.check.yml
83 lines (75 loc) · 2.48 KB
/
docker-compose.check.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
version: "3.8"
x-common-variables:
read-only-workdir: &read-only-workdir
type: bind
source: .
target: /workdir
read_only: true
read-write-workdir: &read-write-workdir
type: bind
source: .
target: /workdir
read_only: false
services:
prettier:
image: grapl/prettier
build:
context: ./etc/formatter
working_dir: /workdir/etc/formatter
entrypoint: ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail"]
command:
- "-c"
- |
echo "Do not run this service directly; it serves only as a source of common configuration!"
exit 42
buf-breaking-change:
image: bufbuild/buf:1.8.0
command: ["breaking", "--against", "https://github.com/grapl-security/grapl.git", "--verbose"]
working_dir: /workdir
volumes:
- *read-only-workdir
# Use buf to rewrite our protobuf files with the proper formatting.
buf-format:
image: bufbuild/buf:1.8.0
command: ["format", "--verbose", "--write"]
environment:
# Since we will be writing files back to our workstation, they
# must be owned by our workstation user. This means we will run
# the container with `--user=$(id --user):$(id --group)`, which
# generally yields a user ID of 1000. Since there is no such
# user in the `bufbuild/buf` container, we are effectively
# anonymous. In such cases, `$HOME` in the container will be `/`.
#
# When formatting, `buf` needs to write to `${HOME}/.cache`.
# Since our anonymous user will not have permissions to write to
# `/.cache`, we must modify the value of `$HOME` to a location
# where we *do* have write permissions. Using `/workdir` will
# result in a `.cache` directory being created in the repository
# root on our workstations, but it will actually allow this to
# *work*, so it's a small price to pay.
HOME: /workdir
working_dir: /workdir
volumes:
- *read-write-workdir
hcl-lint:
image: docker.cloudsmith.io/grapl/releases/hcl-formatter:1.7.4
command: lint
volumes:
- *read-only-workdir
hcl-format:
image: docker.cloudsmith.io/grapl/releases/hcl-formatter:1.7.4
command: format
volumes:
- *read-write-workdir
prettier-lint:
extends:
service: prettier
command: ./format.sh --check
volumes:
- *read-only-workdir
prettier-format:
extends:
service: prettier
command: ./format.sh --update
volumes:
- *read-write-workdir