@intentius/chant-lexicon-docker 0.41.20 → 0.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/integrity.json +2 -2
- package/dist/manifest.json +1 -1
- package/dist/okf/index.md +22 -0
- package/dist/okf/rules/DKRD001.md +15 -0
- package/dist/okf/rules/DKRD002.md +15 -0
- package/dist/okf/rules/DKRD003.md +15 -0
- package/dist/okf/rules/DKRD010.md +11 -0
- package/dist/okf/rules/DKRD011.md +11 -0
- package/dist/okf/rules/DKRD012.md +15 -0
- package/dist/okf/rules/DKRS001.md +15 -0
- package/dist/okf/types/DockerConfig.md +16 -0
- package/dist/okf/types/DockerSecret.md +16 -0
- package/dist/okf/types/Dockerfile.md +30 -0
- package/dist/okf/types/Network.md +18 -0
- package/dist/okf/types/Service.md +33 -0
- package/dist/okf/types/Volume.md +21 -0
- package/package.json +2 -2
- package/src/codegen/__snapshots__/okf.test.ts.snap +315 -0
- package/src/codegen/okf.test.ts +36 -0
- package/src/package-cli.ts +2 -19
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "1d37a0bc6ab65bac642724e68bcf4d555508418350132e287150dd5625a76a76",
|
|
5
5
|
"meta.json": "ae27dc809e705d37a645ee83b9789c50051282f7891d21d6b9e6ce8d111624ff",
|
|
6
6
|
"types/index.d.ts": "758f989ff86af54284d7f841a2db2259038d51ce1f3ed839a5d8e83fa20d95b8",
|
|
7
7
|
"rules/no-latest-tag.ts": "efd060453d8ca3d5b85c3972906c6650b6f63eb5f67cb6cdb0f16a41cad91228",
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"skills/chant-docker.md": "3ff0708e3c76e245f202948949c768464563af2b60cc9aa2ca52f494ef8357f1",
|
|
16
16
|
"skills/chant-docker-patterns.md": "ad1b0196d8150b2df579a699ff107f604340c799c04f3460ebf65003e287b12a"
|
|
17
17
|
},
|
|
18
|
-
"composite": "
|
|
18
|
+
"composite": "2b382c6f20c3779b34a749b1d4fd064f46c3d6d223a3aa3aef74fa9f7bb8ac23"
|
|
19
19
|
}
|
package/dist/manifest.json
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
okf_version: '0.2'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Resource types
|
|
6
|
+
|
|
7
|
+
* [DockerConfig](/types/DockerConfig.md) - Docker::Compose::Config
|
|
8
|
+
* [Dockerfile](/types/Dockerfile.md) - Docker::Dockerfile
|
|
9
|
+
* [DockerSecret](/types/DockerSecret.md) - Docker::Compose::Secret
|
|
10
|
+
* [Network](/types/Network.md) - Docker::Compose::Network
|
|
11
|
+
* [Service](/types/Service.md) - Docker::Compose::Service
|
|
12
|
+
* [Volume](/types/Volume.md) - Docker::Compose::Volume
|
|
13
|
+
|
|
14
|
+
# Rules
|
|
15
|
+
|
|
16
|
+
* [DKRD001](/rules/DKRD001.md) - Service uses :latest or untagged image — specify an explicit version tag
|
|
17
|
+
* [DKRD002](/rules/DKRD002.md) - Named volume is declared but not mounted by any service
|
|
18
|
+
* [DKRD003](/rules/DKRD003.md) - Service exposes SSH port (22) externally — this is a security risk
|
|
19
|
+
* [DKRD010](/rules/DKRD010.md) - apt-get install without --no-install-recommends adds unnecessary packages
|
|
20
|
+
* [DKRD011](/rules/DKRD011.md) - Prefer COPY over ADD when not fetching URLs or extracting archives
|
|
21
|
+
* [DKRD012](/rules/DKRD012.md) - Dockerfile has no USER instruction — container runs as root
|
|
22
|
+
* [DKRS001](/rules/DKRS001.md) - No Latest Tag
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: post-synth-check
|
|
3
|
+
title: DKRD001
|
|
4
|
+
description: Service uses :latest or untagged image — specify an explicit version tag
|
|
5
|
+
id: DKRD001
|
|
6
|
+
severity: error
|
|
7
|
+
category: post-synth
|
|
8
|
+
lexicon: docker
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
10
|
+
---
|
|
11
|
+
Service uses :latest or untagged image — specify an explicit version tag
|
|
12
|
+
|
|
13
|
+
## Applies to
|
|
14
|
+
|
|
15
|
+
- [Service](/types/Service.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: post-synth-check
|
|
3
|
+
title: DKRD002
|
|
4
|
+
description: Named volume is declared but not mounted by any service
|
|
5
|
+
id: DKRD002
|
|
6
|
+
severity: error
|
|
7
|
+
category: post-synth
|
|
8
|
+
lexicon: docker
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
10
|
+
---
|
|
11
|
+
Named volume is declared but not mounted by any service
|
|
12
|
+
|
|
13
|
+
## Applies to
|
|
14
|
+
|
|
15
|
+
- [Volume](/types/Volume.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: post-synth-check
|
|
3
|
+
title: DKRD003
|
|
4
|
+
description: Service exposes SSH port (22) externally — this is a security risk
|
|
5
|
+
id: DKRD003
|
|
6
|
+
severity: error
|
|
7
|
+
category: post-synth
|
|
8
|
+
lexicon: docker
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
10
|
+
---
|
|
11
|
+
Service exposes SSH port (22) externally — this is a security risk
|
|
12
|
+
|
|
13
|
+
## Applies to
|
|
14
|
+
|
|
15
|
+
- [Service](/types/Service.md)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: post-synth-check
|
|
3
|
+
title: DKRD010
|
|
4
|
+
description: apt-get install without --no-install-recommends adds unnecessary packages
|
|
5
|
+
id: DKRD010
|
|
6
|
+
severity: error
|
|
7
|
+
category: post-synth
|
|
8
|
+
lexicon: docker
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
10
|
+
---
|
|
11
|
+
apt-get install without --no-install-recommends adds unnecessary packages
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: post-synth-check
|
|
3
|
+
title: DKRD011
|
|
4
|
+
description: Prefer COPY over ADD when not fetching URLs or extracting archives
|
|
5
|
+
id: DKRD011
|
|
6
|
+
severity: error
|
|
7
|
+
category: post-synth
|
|
8
|
+
lexicon: docker
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
10
|
+
---
|
|
11
|
+
Prefer COPY over ADD when not fetching URLs or extracting archives
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: post-synth-check
|
|
3
|
+
title: DKRD012
|
|
4
|
+
description: Dockerfile has no USER instruction — container runs as root
|
|
5
|
+
id: DKRD012
|
|
6
|
+
severity: error
|
|
7
|
+
category: post-synth
|
|
8
|
+
lexicon: docker
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
10
|
+
---
|
|
11
|
+
Dockerfile has no USER instruction — container runs as root
|
|
12
|
+
|
|
13
|
+
## Applies to
|
|
14
|
+
|
|
15
|
+
- [Dockerfile](/types/Dockerfile.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: lint-rule
|
|
3
|
+
title: DKRS001
|
|
4
|
+
description: No Latest Tag
|
|
5
|
+
id: DKRS001
|
|
6
|
+
severity: warning
|
|
7
|
+
category: correctness
|
|
8
|
+
lexicon: docker
|
|
9
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
10
|
+
---
|
|
11
|
+
No Latest Tag
|
|
12
|
+
|
|
13
|
+
## Applies to
|
|
14
|
+
|
|
15
|
+
- [Service](/types/Service.md)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: resource-type
|
|
3
|
+
title: DockerConfig
|
|
4
|
+
description: A config definition in Docker Compose
|
|
5
|
+
name: DockerConfig
|
|
6
|
+
lexicon: docker
|
|
7
|
+
resource_type: Docker::Compose::Config
|
|
8
|
+
---
|
|
9
|
+
A config definition in Docker Compose
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- `file` (`string`): Path to the config file
|
|
14
|
+
- `external` (`boolean`): Whether the config is external
|
|
15
|
+
- `labels` (`Record<string, string>`): Config labels
|
|
16
|
+
- `name` (`string`): Custom config name
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: resource-type
|
|
3
|
+
title: DockerSecret
|
|
4
|
+
description: A secret definition in Docker Compose
|
|
5
|
+
name: DockerSecret
|
|
6
|
+
lexicon: docker
|
|
7
|
+
resource_type: Docker::Compose::Secret
|
|
8
|
+
---
|
|
9
|
+
A secret definition in Docker Compose
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- `file` (`string`): Path to the secret file
|
|
14
|
+
- `external` (`boolean`): Whether the secret is external
|
|
15
|
+
- `labels` (`Record<string, string>`): Secret labels
|
|
16
|
+
- `name` (`string`): Custom secret name
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: resource-type
|
|
3
|
+
title: Dockerfile
|
|
4
|
+
description: A Dockerfile definition with ordered build instructions
|
|
5
|
+
name: Dockerfile
|
|
6
|
+
lexicon: docker
|
|
7
|
+
resource_type: Docker::Dockerfile
|
|
8
|
+
---
|
|
9
|
+
A Dockerfile definition with ordered build instructions
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- `from`: Base image (required first instruction)
|
|
14
|
+
- `arg`: Build-time argument
|
|
15
|
+
- `env`: Environment variable
|
|
16
|
+
- `run`: Run a command during build
|
|
17
|
+
- `copy`: Copy files from build context
|
|
18
|
+
- `add`: Add files (supports URLs and archives)
|
|
19
|
+
- `workdir`: Set working directory
|
|
20
|
+
- `user`: Set user for subsequent instructions
|
|
21
|
+
- `expose`: Document exposed ports
|
|
22
|
+
- `volume`: Create mount points
|
|
23
|
+
- `label`: Add metadata labels
|
|
24
|
+
- `entrypoint`: Set the entrypoint executable
|
|
25
|
+
- `cmd`: Default command arguments
|
|
26
|
+
- `healthcheck`: Health check instruction
|
|
27
|
+
|
|
28
|
+
## Governed by
|
|
29
|
+
|
|
30
|
+
- [DKRD012](/rules/DKRD012.md): Dockerfile has no USER instruction — container runs as root
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: resource-type
|
|
3
|
+
title: Network
|
|
4
|
+
description: A network definition in Docker Compose
|
|
5
|
+
name: Network
|
|
6
|
+
lexicon: docker
|
|
7
|
+
resource_type: Docker::Compose::Network
|
|
8
|
+
---
|
|
9
|
+
A network definition in Docker Compose
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- `driver` (`string`): Network driver
|
|
14
|
+
- `driver_opts` (`Record<string, string>`): Driver options
|
|
15
|
+
- `external` (`boolean`): Whether the network is external
|
|
16
|
+
- `labels` (`Record<string, string>`): Network labels
|
|
17
|
+
- `internal` (`boolean`): Restrict external access
|
|
18
|
+
- `ipam` (`object`): IP address management
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: resource-type
|
|
3
|
+
title: Service
|
|
4
|
+
description: A containerized service definition in Docker Compose
|
|
5
|
+
name: Service
|
|
6
|
+
lexicon: docker
|
|
7
|
+
resource_type: Docker::Compose::Service
|
|
8
|
+
---
|
|
9
|
+
A containerized service definition in Docker Compose
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- `image` (`string`): Container image to use
|
|
14
|
+
- `build` (`object`): Build configuration
|
|
15
|
+
- `command` (`string | string[]`): Override the default command
|
|
16
|
+
- `entrypoint` (`string | string[]`): Override the default entrypoint
|
|
17
|
+
- `environment` (`Record<string, string>`): Environment variables
|
|
18
|
+
- `ports` (`string[]`): Published ports
|
|
19
|
+
- `volumes` (`string[]`): Volume mounts
|
|
20
|
+
- `networks` (`string[]`): Networks to attach
|
|
21
|
+
- `depends_on` (`string[] | Record<string, { condition: "service_started" | "service_healthy" | "service_completed_successfully"; restart?: boolean; required?: boolean }>`): Service dependencies (short list-form, or long form with a wait condition)
|
|
22
|
+
- `restart` (`string`): Restart policy
|
|
23
|
+
- `labels` (`Record<string, string>`): Container labels
|
|
24
|
+
- `healthcheck` (`object`): Health check configuration
|
|
25
|
+
- `deploy` (`object`): Swarm deployment configuration
|
|
26
|
+
- `secrets` (`string[]`): Secrets to expose
|
|
27
|
+
- `configs` (`string[]`): Configs to expose
|
|
28
|
+
|
|
29
|
+
## Governed by
|
|
30
|
+
|
|
31
|
+
- [DKRD001](/rules/DKRD001.md): Service uses :latest or untagged image — specify an explicit version tag
|
|
32
|
+
- [DKRD003](/rules/DKRD003.md): Service exposes SSH port (22) externally — this is a security risk
|
|
33
|
+
- [DKRS001](/rules/DKRS001.md): No Latest Tag
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: resource-type
|
|
3
|
+
title: Volume
|
|
4
|
+
description: A named volume definition in Docker Compose
|
|
5
|
+
name: Volume
|
|
6
|
+
lexicon: docker
|
|
7
|
+
resource_type: Docker::Compose::Volume
|
|
8
|
+
---
|
|
9
|
+
A named volume definition in Docker Compose
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- `driver` (`string`): Volume driver
|
|
14
|
+
- `driver_opts` (`Record<string, string>`): Driver options
|
|
15
|
+
- `external` (`boolean`): Whether the volume is external
|
|
16
|
+
- `labels` (`Record<string, string>`): Volume labels
|
|
17
|
+
- `name` (`string`): Custom volume name
|
|
18
|
+
|
|
19
|
+
## Governed by
|
|
20
|
+
|
|
21
|
+
- [DKRD002](/rules/DKRD002.md): Named volume is declared but not mounted by any service
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-docker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "Docker lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"typescript": "^5.9.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@intentius/chant": "^0.
|
|
70
|
+
"@intentius/chant": "^0.42.1",
|
|
71
71
|
"typescript": "^5.9.3"
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`docker OKF bundle > packaging emits a conformant, snapshot-stable bundle 1`] = `
|
|
4
|
+
[
|
|
5
|
+
{
|
|
6
|
+
"content": "---
|
|
7
|
+
okf_version: '0.2'
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Resource types
|
|
11
|
+
|
|
12
|
+
* [DockerConfig](/types/DockerConfig.md) - Docker::Compose::Config
|
|
13
|
+
* [Dockerfile](/types/Dockerfile.md) - Docker::Dockerfile
|
|
14
|
+
* [DockerSecret](/types/DockerSecret.md) - Docker::Compose::Secret
|
|
15
|
+
* [Network](/types/Network.md) - Docker::Compose::Network
|
|
16
|
+
* [Service](/types/Service.md) - Docker::Compose::Service
|
|
17
|
+
* [Volume](/types/Volume.md) - Docker::Compose::Volume
|
|
18
|
+
|
|
19
|
+
# Rules
|
|
20
|
+
|
|
21
|
+
* [DKRD001](/rules/DKRD001.md) - Service uses :latest or untagged image — specify an explicit version tag
|
|
22
|
+
* [DKRD002](/rules/DKRD002.md) - Named volume is declared but not mounted by any service
|
|
23
|
+
* [DKRD003](/rules/DKRD003.md) - Service exposes SSH port (22) externally — this is a security risk
|
|
24
|
+
* [DKRD010](/rules/DKRD010.md) - apt-get install without --no-install-recommends adds unnecessary packages
|
|
25
|
+
* [DKRD011](/rules/DKRD011.md) - Prefer COPY over ADD when not fetching URLs or extracting archives
|
|
26
|
+
* [DKRD012](/rules/DKRD012.md) - Dockerfile has no USER instruction — container runs as root
|
|
27
|
+
* [DKRS001](/rules/DKRS001.md) - No Latest Tag
|
|
28
|
+
",
|
|
29
|
+
"path": "index.md",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"content": "---
|
|
33
|
+
type: post-synth-check
|
|
34
|
+
title: DKRD001
|
|
35
|
+
description: Service uses :latest or untagged image — specify an explicit version tag
|
|
36
|
+
id: DKRD001
|
|
37
|
+
severity: error
|
|
38
|
+
category: post-synth
|
|
39
|
+
lexicon: docker
|
|
40
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
41
|
+
---
|
|
42
|
+
Service uses :latest or untagged image — specify an explicit version tag
|
|
43
|
+
|
|
44
|
+
## Applies to
|
|
45
|
+
|
|
46
|
+
- [Service](/types/Service.md)
|
|
47
|
+
",
|
|
48
|
+
"path": "rules/DKRD001.md",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"content": "---
|
|
52
|
+
type: post-synth-check
|
|
53
|
+
title: DKRD002
|
|
54
|
+
description: Named volume is declared but not mounted by any service
|
|
55
|
+
id: DKRD002
|
|
56
|
+
severity: error
|
|
57
|
+
category: post-synth
|
|
58
|
+
lexicon: docker
|
|
59
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
60
|
+
---
|
|
61
|
+
Named volume is declared but not mounted by any service
|
|
62
|
+
|
|
63
|
+
## Applies to
|
|
64
|
+
|
|
65
|
+
- [Volume](/types/Volume.md)
|
|
66
|
+
",
|
|
67
|
+
"path": "rules/DKRD002.md",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"content": "---
|
|
71
|
+
type: post-synth-check
|
|
72
|
+
title: DKRD003
|
|
73
|
+
description: Service exposes SSH port (22) externally — this is a security risk
|
|
74
|
+
id: DKRD003
|
|
75
|
+
severity: error
|
|
76
|
+
category: post-synth
|
|
77
|
+
lexicon: docker
|
|
78
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
79
|
+
---
|
|
80
|
+
Service exposes SSH port (22) externally — this is a security risk
|
|
81
|
+
|
|
82
|
+
## Applies to
|
|
83
|
+
|
|
84
|
+
- [Service](/types/Service.md)
|
|
85
|
+
",
|
|
86
|
+
"path": "rules/DKRD003.md",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"content": "---
|
|
90
|
+
type: post-synth-check
|
|
91
|
+
title: DKRD010
|
|
92
|
+
description: apt-get install without --no-install-recommends adds unnecessary packages
|
|
93
|
+
id: DKRD010
|
|
94
|
+
severity: error
|
|
95
|
+
category: post-synth
|
|
96
|
+
lexicon: docker
|
|
97
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
98
|
+
---
|
|
99
|
+
apt-get install without --no-install-recommends adds unnecessary packages
|
|
100
|
+
",
|
|
101
|
+
"path": "rules/DKRD010.md",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"content": "---
|
|
105
|
+
type: post-synth-check
|
|
106
|
+
title: DKRD011
|
|
107
|
+
description: Prefer COPY over ADD when not fetching URLs or extracting archives
|
|
108
|
+
id: DKRD011
|
|
109
|
+
severity: error
|
|
110
|
+
category: post-synth
|
|
111
|
+
lexicon: docker
|
|
112
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
113
|
+
---
|
|
114
|
+
Prefer COPY over ADD when not fetching URLs or extracting archives
|
|
115
|
+
",
|
|
116
|
+
"path": "rules/DKRD011.md",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"content": "---
|
|
120
|
+
type: post-synth-check
|
|
121
|
+
title: DKRD012
|
|
122
|
+
description: Dockerfile has no USER instruction — container runs as root
|
|
123
|
+
id: DKRD012
|
|
124
|
+
severity: error
|
|
125
|
+
category: post-synth
|
|
126
|
+
lexicon: docker
|
|
127
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
128
|
+
---
|
|
129
|
+
Dockerfile has no USER instruction — container runs as root
|
|
130
|
+
|
|
131
|
+
## Applies to
|
|
132
|
+
|
|
133
|
+
- [Dockerfile](/types/Dockerfile.md)
|
|
134
|
+
",
|
|
135
|
+
"path": "rules/DKRD012.md",
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"content": "---
|
|
139
|
+
type: lint-rule
|
|
140
|
+
title: DKRS001
|
|
141
|
+
description: No Latest Tag
|
|
142
|
+
id: DKRS001
|
|
143
|
+
severity: warning
|
|
144
|
+
category: correctness
|
|
145
|
+
lexicon: docker
|
|
146
|
+
docs: https://intentius.io/chant/lexicons/docker/rules/
|
|
147
|
+
---
|
|
148
|
+
No Latest Tag
|
|
149
|
+
|
|
150
|
+
## Applies to
|
|
151
|
+
|
|
152
|
+
- [Service](/types/Service.md)
|
|
153
|
+
",
|
|
154
|
+
"path": "rules/DKRS001.md",
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"content": "---
|
|
158
|
+
type: resource-type
|
|
159
|
+
title: DockerConfig
|
|
160
|
+
description: A config definition in Docker Compose
|
|
161
|
+
name: DockerConfig
|
|
162
|
+
lexicon: docker
|
|
163
|
+
resource_type: Docker::Compose::Config
|
|
164
|
+
---
|
|
165
|
+
A config definition in Docker Compose
|
|
166
|
+
|
|
167
|
+
## Properties
|
|
168
|
+
|
|
169
|
+
- \`file\` (\`string\`): Path to the config file
|
|
170
|
+
- \`external\` (\`boolean\`): Whether the config is external
|
|
171
|
+
- \`labels\` (\`Record<string, string>\`): Config labels
|
|
172
|
+
- \`name\` (\`string\`): Custom config name
|
|
173
|
+
",
|
|
174
|
+
"path": "types/DockerConfig.md",
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"content": "---
|
|
178
|
+
type: resource-type
|
|
179
|
+
title: Dockerfile
|
|
180
|
+
description: A Dockerfile definition with ordered build instructions
|
|
181
|
+
name: Dockerfile
|
|
182
|
+
lexicon: docker
|
|
183
|
+
resource_type: Docker::Dockerfile
|
|
184
|
+
---
|
|
185
|
+
A Dockerfile definition with ordered build instructions
|
|
186
|
+
|
|
187
|
+
## Properties
|
|
188
|
+
|
|
189
|
+
- \`from\`: Base image (required first instruction)
|
|
190
|
+
- \`arg\`: Build-time argument
|
|
191
|
+
- \`env\`: Environment variable
|
|
192
|
+
- \`run\`: Run a command during build
|
|
193
|
+
- \`copy\`: Copy files from build context
|
|
194
|
+
- \`add\`: Add files (supports URLs and archives)
|
|
195
|
+
- \`workdir\`: Set working directory
|
|
196
|
+
- \`user\`: Set user for subsequent instructions
|
|
197
|
+
- \`expose\`: Document exposed ports
|
|
198
|
+
- \`volume\`: Create mount points
|
|
199
|
+
- \`label\`: Add metadata labels
|
|
200
|
+
- \`entrypoint\`: Set the entrypoint executable
|
|
201
|
+
- \`cmd\`: Default command arguments
|
|
202
|
+
- \`healthcheck\`: Health check instruction
|
|
203
|
+
|
|
204
|
+
## Governed by
|
|
205
|
+
|
|
206
|
+
- [DKRD012](/rules/DKRD012.md): Dockerfile has no USER instruction — container runs as root
|
|
207
|
+
",
|
|
208
|
+
"path": "types/Dockerfile.md",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"content": "---
|
|
212
|
+
type: resource-type
|
|
213
|
+
title: DockerSecret
|
|
214
|
+
description: A secret definition in Docker Compose
|
|
215
|
+
name: DockerSecret
|
|
216
|
+
lexicon: docker
|
|
217
|
+
resource_type: Docker::Compose::Secret
|
|
218
|
+
---
|
|
219
|
+
A secret definition in Docker Compose
|
|
220
|
+
|
|
221
|
+
## Properties
|
|
222
|
+
|
|
223
|
+
- \`file\` (\`string\`): Path to the secret file
|
|
224
|
+
- \`external\` (\`boolean\`): Whether the secret is external
|
|
225
|
+
- \`labels\` (\`Record<string, string>\`): Secret labels
|
|
226
|
+
- \`name\` (\`string\`): Custom secret name
|
|
227
|
+
",
|
|
228
|
+
"path": "types/DockerSecret.md",
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"content": "---
|
|
232
|
+
type: resource-type
|
|
233
|
+
title: Network
|
|
234
|
+
description: A network definition in Docker Compose
|
|
235
|
+
name: Network
|
|
236
|
+
lexicon: docker
|
|
237
|
+
resource_type: Docker::Compose::Network
|
|
238
|
+
---
|
|
239
|
+
A network definition in Docker Compose
|
|
240
|
+
|
|
241
|
+
## Properties
|
|
242
|
+
|
|
243
|
+
- \`driver\` (\`string\`): Network driver
|
|
244
|
+
- \`driver_opts\` (\`Record<string, string>\`): Driver options
|
|
245
|
+
- \`external\` (\`boolean\`): Whether the network is external
|
|
246
|
+
- \`labels\` (\`Record<string, string>\`): Network labels
|
|
247
|
+
- \`internal\` (\`boolean\`): Restrict external access
|
|
248
|
+
- \`ipam\` (\`object\`): IP address management
|
|
249
|
+
",
|
|
250
|
+
"path": "types/Network.md",
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"content": "---
|
|
254
|
+
type: resource-type
|
|
255
|
+
title: Service
|
|
256
|
+
description: A containerized service definition in Docker Compose
|
|
257
|
+
name: Service
|
|
258
|
+
lexicon: docker
|
|
259
|
+
resource_type: Docker::Compose::Service
|
|
260
|
+
---
|
|
261
|
+
A containerized service definition in Docker Compose
|
|
262
|
+
|
|
263
|
+
## Properties
|
|
264
|
+
|
|
265
|
+
- \`image\` (\`string\`): Container image to use
|
|
266
|
+
- \`build\` (\`object\`): Build configuration
|
|
267
|
+
- \`command\` (\`string | string[]\`): Override the default command
|
|
268
|
+
- \`entrypoint\` (\`string | string[]\`): Override the default entrypoint
|
|
269
|
+
- \`environment\` (\`Record<string, string>\`): Environment variables
|
|
270
|
+
- \`ports\` (\`string[]\`): Published ports
|
|
271
|
+
- \`volumes\` (\`string[]\`): Volume mounts
|
|
272
|
+
- \`networks\` (\`string[]\`): Networks to attach
|
|
273
|
+
- \`depends_on\` (\`string[] | Record<string, { condition: "service_started" | "service_healthy" | "service_completed_successfully"; restart?: boolean; required?: boolean }>\`): Service dependencies (short list-form, or long form with a wait condition)
|
|
274
|
+
- \`restart\` (\`string\`): Restart policy
|
|
275
|
+
- \`labels\` (\`Record<string, string>\`): Container labels
|
|
276
|
+
- \`healthcheck\` (\`object\`): Health check configuration
|
|
277
|
+
- \`deploy\` (\`object\`): Swarm deployment configuration
|
|
278
|
+
- \`secrets\` (\`string[]\`): Secrets to expose
|
|
279
|
+
- \`configs\` (\`string[]\`): Configs to expose
|
|
280
|
+
|
|
281
|
+
## Governed by
|
|
282
|
+
|
|
283
|
+
- [DKRD001](/rules/DKRD001.md): Service uses :latest or untagged image — specify an explicit version tag
|
|
284
|
+
- [DKRD003](/rules/DKRD003.md): Service exposes SSH port (22) externally — this is a security risk
|
|
285
|
+
- [DKRS001](/rules/DKRS001.md): No Latest Tag
|
|
286
|
+
",
|
|
287
|
+
"path": "types/Service.md",
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"content": "---
|
|
291
|
+
type: resource-type
|
|
292
|
+
title: Volume
|
|
293
|
+
description: A named volume definition in Docker Compose
|
|
294
|
+
name: Volume
|
|
295
|
+
lexicon: docker
|
|
296
|
+
resource_type: Docker::Compose::Volume
|
|
297
|
+
---
|
|
298
|
+
A named volume definition in Docker Compose
|
|
299
|
+
|
|
300
|
+
## Properties
|
|
301
|
+
|
|
302
|
+
- \`driver\` (\`string\`): Volume driver
|
|
303
|
+
- \`driver_opts\` (\`Record<string, string>\`): Driver options
|
|
304
|
+
- \`external\` (\`boolean\`): Whether the volume is external
|
|
305
|
+
- \`labels\` (\`Record<string, string>\`): Volume labels
|
|
306
|
+
- \`name\` (\`string\`): Custom volume name
|
|
307
|
+
|
|
308
|
+
## Governed by
|
|
309
|
+
|
|
310
|
+
- [DKRD002](/rules/DKRD002.md): Named volume is declared but not mounted by any service
|
|
311
|
+
",
|
|
312
|
+
"path": "types/Volume.md",
|
|
313
|
+
},
|
|
314
|
+
]
|
|
315
|
+
`;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { packageLexicon } from "./package";
|
|
3
|
+
import { okfConformanceProblems, splitFrontmatter } from "@intentius/chant/okf";
|
|
4
|
+
import { parseYAML } from "@intentius/chant/yaml";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The lexicon OKF bundle (#1060) over docker — the hand-authored generation
|
|
8
|
+
* path, where descriptions live in the registry itself. Small enough to
|
|
9
|
+
* snapshot whole.
|
|
10
|
+
*/
|
|
11
|
+
describe("docker OKF bundle", () => {
|
|
12
|
+
test("packaging emits a conformant, snapshot-stable bundle", async () => {
|
|
13
|
+
const { spec } = await packageLexicon();
|
|
14
|
+
expect(spec.okf).toBeDefined();
|
|
15
|
+
expect(okfConformanceProblems(spec.okf!)).toEqual([]);
|
|
16
|
+
expect(spec.okf).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("resource concepts and rules cross-link in both directions", async () => {
|
|
20
|
+
const { spec } = await packageLexicon();
|
|
21
|
+
const files = new Map(spec.okf!.map((f) => [f.path, f.content]));
|
|
22
|
+
|
|
23
|
+
const service = splitFrontmatter(files.get("types/Service.md")!)!;
|
|
24
|
+
const front = parseYAML(service.frontmatter);
|
|
25
|
+
expect(front.type).toBe("resource-type");
|
|
26
|
+
expect(front.resource_type).toBe("Docker::Compose::Service");
|
|
27
|
+
// Registry-carried property description reaches the concept body.
|
|
28
|
+
expect(service.body).toContain("- `image` (`string`): Container image to use");
|
|
29
|
+
// The no-latest-tag rule governs Service…
|
|
30
|
+
expect(service.body).toContain("[DKRS001](/rules/DKRS001.md)");
|
|
31
|
+
// …and points back at it.
|
|
32
|
+
const rule = splitFrontmatter(files.get("rules/DKRS001.md")!)!;
|
|
33
|
+
expect(parseYAML(rule.frontmatter).severity).toBe("warning");
|
|
34
|
+
expect(rule.body).toContain("- [Service](/types/Service.md)");
|
|
35
|
+
});
|
|
36
|
+
});
|
package/src/package-cli.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { generate, writeGeneratedFiles } from "./codegen/generate";
|
|
6
6
|
import { packageLexicon } from "./codegen/package";
|
|
7
|
-
import {
|
|
7
|
+
import { writeBundleSpec } from "@intentius/chant/codegen/package";
|
|
8
8
|
import { join, dirname } from "path";
|
|
9
9
|
import { fileURLToPath } from "url";
|
|
10
10
|
|
|
@@ -19,24 +19,7 @@ console.error(`Generated ${genResult.resources} entities, ${genResult.properties
|
|
|
19
19
|
const { spec, stats } = await packageLexicon({ verbose: true });
|
|
20
20
|
|
|
21
21
|
const distDir = join(pkgDir, "dist");
|
|
22
|
-
|
|
23
|
-
mkdirSync(join(distDir, "rules"), { recursive: true });
|
|
24
|
-
mkdirSync(join(distDir, "skills"), { recursive: true });
|
|
25
|
-
|
|
26
|
-
writeFileSync(join(distDir, "manifest.json"), JSON.stringify(spec.manifest, null, 2));
|
|
27
|
-
writeFileSync(join(distDir, "meta.json"), spec.registry);
|
|
28
|
-
writeFileSync(join(distDir, "types", "index.d.ts"), spec.typesDTS);
|
|
29
|
-
|
|
30
|
-
for (const [name, content] of spec.rules) {
|
|
31
|
-
writeFileSync(join(distDir, "rules", name), content);
|
|
32
|
-
}
|
|
33
|
-
for (const [name, content] of spec.skills) {
|
|
34
|
-
writeFileSync(join(distDir, "skills", name), content);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (spec.integrity) {
|
|
38
|
-
writeFileSync(join(distDir, "integrity.json"), JSON.stringify(spec.integrity, null, 2));
|
|
39
|
-
}
|
|
22
|
+
writeBundleSpec(spec, distDir);
|
|
40
23
|
|
|
41
24
|
console.error(`Packaged ${stats.resources} entities, ${stats.ruleCount} rules, ${stats.skillCount} skills`);
|
|
42
25
|
console.error(`dist/ written to ${distDir}`);
|