Skip to content

Commit 51d8927

Browse files
committed
feat(docker-compose): add missing service specs
1 parent 57078c8 commit 51d8927

File tree

2 files changed

+85
-19
lines changed

2 files changed

+85
-19
lines changed

.changeset/new-stingrays-glow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@anymodel/docker-compose": minor
3+
---
4+
5+
Add missing service specs

packages/docker-compose/src/manifests/Service.ts

Lines changed: 80 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,33 @@ import type { Network } from "./Network";
22
import type { ServicePort } from "./ServicePort";
33
import type { ServiceVolume } from "./ServiceVolume";
44

5+
export type ServiceLoggingMap = {
6+
none: any;
7+
local: any;
8+
"json-file": {
9+
"max-size"?: string;
10+
"max-file"?: string | number;
11+
};
12+
syslog: {
13+
"syslog-address"?: string;
14+
};
15+
journald: any;
16+
gelf: any;
17+
fluentd: any;
18+
awslogs: any;
19+
splunk: any;
20+
etwlogs: any;
21+
gcplogs: any;
22+
logentries: any;
23+
};
24+
25+
export type ServiceLogging = {
26+
[K in keyof ServiceLoggingMap]: {
27+
driver: K;
28+
options?: ServiceLoggingMap[K];
29+
};
30+
}[keyof ServiceLoggingMap];
31+
532
/**
633
* @link https://linux.die.net/man/7/capabilities
734
*/
@@ -52,41 +79,75 @@ type Cap =
5279

5380
export type ServiceSpec = {
5481
build?: {
82+
args?: Record<string, string> | string[];
83+
cache_from?: string[];
5584
context?: string;
5685
dockerfile?: string;
57-
args?: Record<string, string>;
86+
labels?: string[];
87+
network?: string;
88+
shm_size?: string | number;
89+
target?: string;
5890
};
91+
cap_add?: (Cap | "all")[];
92+
cap_drop?: Cap[];
93+
cgroup_parent?: string;
5994
command?: string | string[];
60-
entrypoint?: string | string[];
61-
image?: string;
62-
labels?: string[];
6395
container_name?: string;
64-
logging?: {
65-
driver: "json-file";
66-
options: {
67-
"max-size": string;
68-
"max-file": string | number;
69-
};
96+
credential_spec?: {
97+
config?: string;
98+
file?: string;
99+
registry?: string;
70100
};
71-
env_file?: string[];
72-
environment?: Record<string, string>;
73101
depends_on?: (string | Service)[];
74-
cap_add?: (Cap | "all")[];
75-
cap_drop?: Cap[];
76-
working_dir?: string;
77-
restart?: "no" | "on-failure" | "always" | "unless-stopped";
102+
devices?: string | string[];
103+
dns_search?: string | string[];
104+
dns?: string | string[];
105+
entrypoint?: string | string[];
106+
env_file?: string | string[];
107+
environment?: Record<string, string> | string[];
108+
expose?: string[];
109+
external_links?: string[];
78110
extra_hosts?: (string | [string, string])[];
79-
networks?: (string | Network)[];
111+
healthcheck?: {
112+
disable?: boolean;
113+
interval?: string;
114+
retries?: number;
115+
start_period?: string;
116+
test?: string | string[];
117+
timeout?: string;
118+
};
119+
image?: string;
120+
init?: boolean;
121+
labels?: string[];
122+
logging?: ServiceLogging;
80123
network_mode?:
81124
| "bridge"
82125
| "host"
83126
| "none"
84127
| { service: string | Service }
85128
| { container: string };
86-
privileged?: boolean;
129+
networks?: (string | Network)[];
130+
pid?: string;
87131
ports?: (string | ServicePort)[];
88-
volumes?: (string | ServiceVolume)[];
132+
privileged?: boolean;
133+
profiles?: string[];
134+
restart?: "no" | "on-failure" | "always" | "unless-stopped";
135+
security_opt?: string[];
136+
stop_grace_period?: string;
137+
stop_signal?: string;
138+
sysctls?: Record<string, string | number> | string[];
139+
tmpfs?: string | string[];
140+
ulimits?: {
141+
nproc?: number;
142+
nofile?: {
143+
hard?: number;
144+
soft?: number;
145+
};
146+
};
147+
userns_mode?: string;
89148
volumes_from?: (string | Service)[];
149+
volumes?: (string | ServiceVolume)[];
150+
working_dir?: string;
90151
};
91152

92153
export class Service {

0 commit comments

Comments
 (0)