From 0ca4e30b19ea316d058d947f73e97886f85ce2e9 Mon Sep 17 00:00:00 2001 From: Pascal M <11357019+perzeuss@users.noreply.github.com> Date: Sun, 28 Apr 2024 06:30:56 +0200 Subject: [PATCH] feat: add start commands to devcontainer (#3902) --- .devcontainer/devcontainer.json | 4 ++-- .devcontainer/post_create_command.sh | 10 ++++++++++ .devcontainer/post_start_command.sh | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100755 .devcontainer/post_create_command.sh create mode 100755 .devcontainer/post_start_command.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b61a8f7a42..ebc8bf74c1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -32,8 +32,8 @@ ] } }, - "postStartCommand": "cd api && pip install -r requirements.txt", - "postCreateCommand": "cd web && npm install" + "postStartCommand": "./.devcontainer/post_start_command.sh", + "postCreateCommand": "./.devcontainer/post_create_command.sh" // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, diff --git a/.devcontainer/post_create_command.sh b/.devcontainer/post_create_command.sh new file mode 100755 index 0000000000..965c0c36ad --- /dev/null +++ b/.devcontainer/post_create_command.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +cd web && npm install + +echo 'alias start-api="cd /workspaces/dify/api && flask run --host 0.0.0.0 --port=5001 --debug"' >> ~/.bashrc +echo 'alias start-worker="cd /workspaces/dify/api && celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail"' >> ~/.bashrc +echo 'alias start-web="cd /workspaces/dify/web && npm run dev"' >> ~/.bashrc +echo 'alias start-containers="cd /workspaces/dify/docker && docker-compose -f docker-compose.middleware.yaml -p dify up -d"' >> ~/.bashrc + +source /home/vscode/.bashrc \ No newline at end of file diff --git a/.devcontainer/post_start_command.sh b/.devcontainer/post_start_command.sh new file mode 100755 index 0000000000..633da9649c --- /dev/null +++ b/.devcontainer/post_start_command.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +cd api && pip install -r requirements.txt \ No newline at end of file