josal/entities/compose.d.ts

221 lines
3.8 KiB
TypeScript
Raw Normal View History

type Label = {
[label: string]: string
}
type WeightDevice = Array<{
path: string
weight: number
}>
type DeviceBLK = Array<{
path: string
rate: number | string
}>
type BuildServices = {
context: string
dockefile: string
dockerfile_inline: string
args: Label
ssh: Array<string>
cache_from: Array<string>
cache_to: Array<string>
additional_contexts: Array<Label>
extra_hosts: Label
labels: Label
privileged: boolean
no_cache: boolean
network: "none" | "host" | string
shm_size: number | string
target: string
secrets: Array<string>
tags: Array<string>
platforms: Array<string>
ulimits: {
nproc: number
nofile: {
soft: number
hard: number
}
}
}
enum Runtimes {
runc,
crun,
youki,
inclavare,
gvisor,
wasmtime,
katacontainers,
}
export type Services = {
[name: string]: {
annotations?: Label
image: string
ports?: Array<string>
attach?: boolean
build?: BuildServices
blkio_config?: {
weight: number
weight_device: Array<{
path: string
weight: number
}>
device_read_bps: DeviceBLK
device_read_iops: DeviceBLK
device_write_bps: DeviceBLK
device_write_iops: DeviceBLK
}
cpu_count?: number
cpu_persent?: number | string
cpu_quota?: number | string
cpu_rt_runtime?: number | string
cpu_rt_period?: number | string
cpus?: string
cpuset?: string
cap_add?: Array<string>
cap_drop?: Array<string>
cgroup?: "host" | "private"
cpu_rt_period?: string
command?: Array<string> | string
configs?:
| Array<string>
| Array<{
source: string
target: string
uid: string
gid: string
mode: number
}>
container_name?: string
credential_spec?: {
file?: string
registry?: string
}
depends_on?: Array<string>
dns?: string | Array<string>
dns_opt?: Array<string>
dns_search?: string | Array<string>
entrypoint?: string | Array<string>
tmpfs?: string | Array<string>
env_file?:
| Array<string>
| Array<{
path: string
required: boolean
}>
environment?: Array<string>
expose?: Array<string>
extends?: {
file: string
service: string
}
}
external_links?: Array<string>
volumes_from?: Array<string>
tty?: boolean
sysctl?: Label
runtime: Runtimes
restart:
| "no"
| "always"
| "unless-stopped"
| "on-failure"
| { "on-failure": number }
workdir?: string
extra_hosts?: string
stdin_open?: boolean
init?: boolean
profiles?: Array<string>
network_mode?: "none" | "host"
logging?: {
driver: string
options?: Label
}
links?: Array<string>
labels?: Array<Label>
group_add?: Array<string>
pids_limit?: number
pull_policy?: "always" | "never" | "missing" | "build"
hostname?: string
devices?: Array<string>
volumes?: Array<string>
uts?: "host" | string
mem_limit?: number | string
healthcheck?: {
test: Array<string>
timeout?: string
interval?: string
start_period?: string
start_interval?: string
retries: number
disable?: true
}
}
type Networks = {
[name: string]: {
driver?: string
driver_opts?: Label
attachable?: boolean
enable_ipv6?: boolean
external?: boolean
name?: string
ipam?: {
driver?: string
config?: Array<{
subnet: string
ip_range: string
gateway: string
aux_addresses: Array<Label>
}>
}
labels?: Array<Label>
options?: Array<Label>
}
}
type Volumes = {
[name: string]: {
external?: boolean
labels?: Array<Label>
driver?: string
driver_opts?: Label
name?: string
}
}
type Configs = {
[name: string]: {
external?: boolean
name?: string
file?: string
environment?: string
content?: string
}
}
type Secrets = {
[name: string]:
| {
file?: string
}
| {
token: {
environment: string
}
}
}
export type Compose = {
version?: "3"
services: Services
networks?: Networks
volumes?: Volumes
configs?: Configs
secrets?: Secrets
}