Skip to content

Commit 6157777

Browse files
committed
Feature: Add devcontainer configuration
Signed-off-by: Johan Forngren <[email protected]>
1 parent 13fce45 commit 6157777

File tree

4 files changed

+83
-13
lines changed

4 files changed

+83
-13
lines changed

Diff for: .devcontainer/devcontainer.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "Node.js & TypeScript",
3+
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bookworm",
4+
"forwardPorts": [
5+
3000
6+
],
7+
"portsAttributes": {
8+
"3000": {
9+
"label": "Flowise"
10+
}
11+
},
12+
13+
// Volume mounts for persistent storage between container rebuilds
14+
"mounts": [
15+
// Persists node_modules to avoid reinstalling packages on container rebuild
16+
// Using Docker volumes instead of bind mounts improves I/O performance significantly
17+
"source=${localWorkspaceFolderBasename}-node_modules,target=/workspaces/${localWorkspaceFolderBasename}/node_modules,type=volume",
18+
// Persists pnpm's global store to cache downloaded packages
19+
// Located in the node user's home directory to avoid permission issues
20+
"source=${localWorkspaceFolderBasename}-pnpm-store,target=/home/node/.local/share/pnpm/store,type=volume"
21+
],
22+
23+
// Commands to run after the container is created but before VS Code connects
24+
// 1. Create directories 2. Fix permissions 3. Install pnpm 4. Configure pnpm store 5. Install dependencies
25+
"postCreateCommand": "sudo mkdir -p /workspaces/${localWorkspaceFolderBasename}/node_modules /home/node/.local/share/pnpm/store && sudo chown -R node:node /workspaces/${localWorkspaceFolderBasename} /home/node/.local/share/pnpm/store && npm i -g pnpm && pnpm config set store-dir /home/node/.local/share/pnpm/store && pnpm install",
26+
// VS Code specific settings
27+
"customizations": {
28+
"vscode": {
29+
"settings": {
30+
// Use pnpm as the default package manager in VS Code
31+
"npm.packageManager": "pnpm"
32+
}
33+
}
34+
}
35+
}

Diff for: .gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# editor
22
.idea
3-
.vscode
43

54
# dependencies
65
**/node_modules
@@ -81,7 +80,7 @@
8180
*.csr
8281

8382
## Certificate
84-
*.der
83+
*.der
8584

8685
## Key database file
8786
*.kdb

Diff for: .vscode/extensions.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"ms-vscode-remote.remote-containers"
6+
]
7+
}

Diff for: README.md

+40-11
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ English | [繁體中文](./i18n/README-TW.md) | [簡體中文](./i18n/README-ZH.
2121
Download and Install [NodeJS](https://nodejs.org/en/download) >= 18.15.0
2222

2323
1. Install Flowise
24+
2425
```bash
2526
npm install -g flowise
2627
```
28+
2729
2. Start Flowise
2830

2931
```bash
@@ -52,16 +54,19 @@ Download and Install [NodeJS](https://nodejs.org/en/download) >= 18.15.0
5254
### Docker Image
5355

5456
1. Build the image locally:
57+
5558
```bash
5659
docker build --no-cache -t flowise .
5760
```
61+
5862
2. Run image:
5963

6064
```bash
6165
docker run -d --name flowise -p 3000:3000 flowise
6266
```
6367

6468
3. Stop image:
69+
6570
```bash
6671
docker stop flowise
6772
```
@@ -75,57 +80,81 @@ Flowise has 3 different modules in a single mono repository.
7580
- `components`: Third-party nodes integrations
7681
- `api-documentation`: Auto-generated swagger-ui API docs from express
7782

78-
### Prerequisite
83+
You can develop Flowise either directly on your local machine or using Dev Containers for a more isolated and consistent development environment.
84+
85+
### Option 1: Setup on local machine
86+
87+
1. Install [PNPM](https://pnpm.io/installation)
7988

80-
- Install [PNPM](https://pnpm.io/installation)
8189
```bash
8290
npm i -g pnpm
8391
```
8492

85-
### Setup
86-
87-
1. Clone the repository
93+
2. Clone the repository
8894

8995
```bash
9096
git clone https://github.com/FlowiseAI/Flowise.git
9197
```
9298

93-
2. Go into repository folder
99+
3. Go into repository folder
94100

95101
```bash
96102
cd Flowise
97103
```
98104

99-
3. Install all dependencies of all modules:
105+
4. Install all dependencies of all modules:
100106

101107
```bash
102108
pnpm install
103109
```
104110

105-
4. Build all the code:
111+
### Option 2: Setup with Dev Containers
112+
113+
Using [Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers) provides a consistent development environment for all contributors without worrying about local dependencies.
114+
115+
1. Install the prerequisites:
116+
117+
- [Visual Studio Code](https://code.visualstudio.com/)
118+
- [Docker](https://www.docker.com/products/docker-desktop/)
119+
- [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
120+
121+
2. Clone the repository and open it in VS Code
122+
123+
```bash
124+
git clone https://github.com/FlowiseAI/Flowise.git
125+
code Flowise
126+
```
127+
128+
3. When prompted "Reopen in Container", click it, or run the command "Dev Containers: Reopen in Container" from the command palette (F1)
129+
130+
4. The container will install dependencies automatically. This process may take a few minutes for the first time.
131+
132+
### Build and start
133+
134+
1. Build all the code:
106135

107136
```bash
108137
pnpm build
109138
```
110139

111140
<details>
112-
<summary>Exit code 134 (JavaScript heap out of memory)</summary>
141+
<summary>Exit code 134 (JavaScript heap out of memory)</summary>
113142
If you get this error when running the above `build` script, try increasing the Node.js heap size and run the script again:
114143

115144
export NODE_OPTIONS="--max-old-space-size=4096"
116145
pnpm build
117146

118147
</details>
119148

120-
5. Start the app:
149+
2. Start the app:
121150

122151
```bash
123152
pnpm start
124153
```
125154

126155
You can now access the app on [http://localhost:3000](http://localhost:3000)
127156

128-
6. For development build:
157+
3. For development build:
129158

130159
- Create `.env` file and specify the `VITE_PORT` (refer to `.env.example`) in `packages/ui`
131160
- Create `.env` file and specify the `PORT` (refer to `.env.example`) in `packages/server`

0 commit comments

Comments
 (0)