Skip to content

Commit 07ab028

Browse files
authored
Add support for dev containers. (#2248)
Co-authored-by: = <=>
1 parent edfd557 commit 07ab028

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

.devcontainer/.env

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
POSTGRES_USER=postgres
2+
POSTGRES_PASSWORD=abc123
3+
POSTGRES_DB=postgres
4+
POSTGRES_HOST=postgres
5+
POSTGRES_PORT=5432
6+
7+
ZENSTACK_TEST_DB_USER=postgres
8+
ZENSTACK_TEST_DB_PASS=abc123
9+
ZENSTACK_TEST_DB_NAME=postgres
10+
ZENSTACK_TEST_DB_HOST=postgres
11+
ZENSTACK_TEST_DB_PORT=5432

.devcontainer/devcontainer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "zenstack",
3+
"dockerComposeFile": [
4+
"./docker-compose.yml"
5+
],
6+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
7+
"workspaceFolder": "/workspace",
8+
"service": "workspace",
9+
"shutdownAction": "stopCompose",
10+
"postCreateCommand": "npm i -g pnpm@9.15.9 && pnpm install && pnpm build && pnpm test-scaffold",
11+
"remoteUser": "node",
12+
"customizations": {
13+
"vscode": {
14+
"extensions": [
15+
"langium.langium-vscode",
16+
"firsttris.vscode-jest-runner"
17+
]
18+
}
19+
}
20+
}

.devcontainer/docker-compose.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: zenstack
2+
3+
volumes:
4+
postgres-data:
5+
6+
networks:
7+
workspace:
8+
external: false
9+
10+
services:
11+
workspace:
12+
container_name: zenstack-workspace
13+
image: mcr.microsoft.com/devcontainers/javascript-node:20
14+
restart: always
15+
volumes:
16+
- ..:/workspace:cached
17+
env_file: ./.env
18+
command: sleep infinity
19+
networks:
20+
- workspace
21+
22+
postgres:
23+
container_name: zenstack-postgres
24+
image: postgres
25+
restart: always
26+
volumes:
27+
- postgres-data:/var/lib/postgresql/
28+
env_file: ./.env
29+
networks:
30+
- workspace
31+
ports:
32+
- 5432:5432
33+
healthcheck:
34+
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
35+
interval: 5s
36+
timeout: 5s
37+
retries: 5

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ dist
88
coverage
99
.build
1010
.test
11+
.pnpm-store

0 commit comments

Comments
 (0)