-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
153 lines (145 loc) · 4.17 KB
/
Copy pathdocker-compose.yml
File metadata and controls
153 lines (145 loc) · 4.17 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Copyright (C) 2024-2026 jango_blockchained
# SPDX-License-Identifier: AGPL-3.0-or-later
# Local development stack for the PYNE Pro API + CLI.
#
# docker compose up --build api
# PYNE_RUNNER=1 PYNE_RUNNER_SCHEDULER=1 docker compose up --build api
# docker compose --profile redis up --build
# docker compose --profile lsp run --rm lsp
# docker compose --profile cli run --rm cli check script.pine
# docker compose -f docker-compose.yml -f docker-compose.prod.yml up --build -d
#
# Host port defaults to 5002 (AXIS / local docs expect the API there).
name: pynescript
services:
api:
build:
context: .
dockerfile: Dockerfile
target: api-dev
args:
PYNESCRIPT_VERSION: ${PYNESCRIPT_VERSION:-0.2.0}
GIT_SHA: ${GIT_SHA:-dev}
image: pynescript-api:dev
ports:
- "${API_PORT:-5002}:8080"
env_file:
- path: .env
required: false
environment:
HOST: "0.0.0.0"
PORT: "8080"
FLASK_ENV: development
FLASK_DEBUG: "${FLASK_DEBUG:-1}"
API_KEY_STORE: /data/api_keys.json
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-https://hoox.sh,https://hoox.sh/axis,http://localhost:8081,http://127.0.0.1:8081}
ADMIN_TOKEN: ${ADMIN_TOKEN:-}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
PYTHONPATH: /app/src:/app
# Optional hosted runner (script registry + bar-close). Off by default.
PYNE_RUNNER: ${PYNE_RUNNER:-0}
PYNE_RUNNER_SCHEDULER: ${PYNE_RUNNER_SCHEDULER:-0}
PYNE_RUNNER_POLL_SECONDS: ${PYNE_RUNNER_POLL_SECONDS:-60}
PYNE_RUNNER_DB: /data/runner.db
volumes:
- ./src:/app/src:ro
- ./backend:/app/backend:ro
- api_data:/data
healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8080/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
restart: unless-stopped
networks:
- pynescript
# When the redis profile is active, wait for it; otherwise ignore.
depends_on:
redis:
condition: service_healthy
required: false
redis:
image: redis:7-alpine
profiles:
- redis
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
command: ["redis-server", "--appendonly", "yes"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 5s
retries: 3
start_period: 5s
restart: unless-stopped
networks:
- pynescript
lsp:
build:
context: .
dockerfile: Dockerfile
target: lsp
args:
PYNESCRIPT_VERSION: ${PYNESCRIPT_VERSION:-0.2.0}
GIT_SHA: ${GIT_SHA:-dev}
image: pynescript-lsp:latest
profiles:
- lsp
environment:
PYTHONPATH: /app/src
volumes:
- ./src:/app/src:ro
# stdio language server — use `docker compose run --rm -i lsp` for interactive
stdin_open: true
tty: false
networks:
- pynescript
# Ephemeral CLI — `docker compose --profile cli run --rm cli check script.pine`
# No ports, no env_file (avoids leaking host .env secrets), no privileged.
# No healthcheck: process is a one-shot Click command, not a daemon.
cli:
build:
context: .
dockerfile: Dockerfile
target: cli
args:
PYNESCRIPT_VERSION: ${PYNESCRIPT_VERSION:-0.2.0}
GIT_SHA: ${GIT_SHA:-dev}
image: pynescript-cli:latest
profiles:
- cli
user: "1000:1000"
working_dir: /work
environment:
PYTHONPATH: /app/src
PYNE_COMPILE_DISK_CACHE: "1"
PYNE_COMPILE_CACHE_DIR: /data/compile-cache
XDG_CACHE_HOME: /data/cache
volumes:
# Package sources read-only (prefer over site-packages via PYTHONPATH)
- ./src:/app/src:ro
# Workspace for .pine inputs/outputs (host CWD). Keep rw for format/write.
- .:/work
# Persistent IR / Numba disk cache across runs
- cli_data:/data
tmpfs:
- /tmp:size=64m,mode=1777
read_only: true
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
# Ephemeral — do not restart; use `compose run --rm`
restart: "no"
networks:
- pynescript
volumes:
api_data:
redis_data:
cli_data:
networks:
pynescript:
name: pynescript-dev