-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathDockerfile-bash.sublime-syntax
82 lines (73 loc) · 2.3 KB
/
Dockerfile-bash.sublime-syntax
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
%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
name: Dockerfile (with bash)
scope: source.dockerfile.bash
variables:
identifier: '[[:alnum:]]+'
onbuild_directive: (?i:(onbuild)\s+)?
onbuild_commands_directive:
"{{onbuild_directive}}(?i:add|arg|env|copy|expose|healthcheck|label|shell|stopsignal|user|volume|workdir)"
nononbuild_commands_directive: (?i:maintainer)
embeddable_directive: '{{onbuild_directive}}(?i:run|cmd|entrypoint)'
from_directive: (?i:(from))\s+[^\s:@]+(?:[:@](\S+))?(?:\s+(?i:(as))\s+(\S+))?
contexts:
main:
- include: comments
- match: ^(?i:arg)\s
scope: keyword.control.dockerfile
- include: from
expect-container-tag:
- match: ({{identifier}}(?:/{{identifier}})?)(?:([:@])(\S+))?
captures:
1: entity.name.label.dockerfile
2: punctuation.separator.dockerfile
3: constant.numeric.dockerfile
pop: true
from:
- match: ^{{from_directive}}
captures:
1: keyword.control.from.dockerfile
2: entity.name.enum.tag-digest
3: keyword.control.dockerfile
4: variable.stage-name
push: body
body:
- include: comments
- include: directives
- include: from
- include: invalid
directives:
- match: ^\s*({{embeddable_directive}})\b
captures:
1: keyword.control.dockerfile
push:
- match: (?=\s*\[)
set: scope:source.json#arrays
with_prototype:
- match: \n
pop: true
- match: ""
set: scope:source.shell.bash
with_prototype:
- include: scope:source.shell.bash#prototype
- match: \n|^(?=\S)
pop: true
- match: ^\s*{{onbuild_commands_directive}}\s
captures:
0: keyword.control.dockerfile
1: keyword.other.special-method.dockerfile
push: scope:source.shell.bash#cmd-args
- match: ^\s*{{nononbuild_commands_directive}}\s
scope: keyword.control.dockerfile
push: scope:source.shell.bash#cmd-args
invalid:
- match: ^[^A-Z\n](.*)$
scope: invalid.illegal.dockerfile
comments:
- match: ^(\s*)((#).*$\n?)
comment: comment.line
captures:
1: punctuation.whitespace.comment.leading.dockerfile
2: comment.dockerfile
3: punctuation.definition.comment.dockerfile