Skip to content

Commit f67cea8

Browse files
authored
update: runtime entrypoints, make it easy to use. (#17)
* update: language entrypoint and codes. * update: part of framework entrypoint and codes. * update: add app env to set devbox running env * update: add app env to set devbox running env * update: fix some entrypoint and is_cn flag
1 parent fae741f commit f67cea8

File tree

85 files changed

+3603
-137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+3603
-137
lines changed

.github/workflows/docker-image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
echo "image_name=$image_name" >> $GITHUB_OUTPUT
7575
echo "image_name_cn=$image_name_cn" >> $GITHUB_OUTPUT
7676
echo "building image $image_name"
77-
is_cn=0 bash script/build_and_push_images.sh "${{ matrix.build_target }}" "$image_name" $is_cn
77+
is_cn="0" bash script/build_and_push_images.sh "${{ matrix.build_target }}" "$image_name" $is_cn
7878
echo "building image $image_name_cn"
79-
is_cn=1 bash script/build_and_push_images.sh "${{ matrix.build_target }}" "$image_name_cn" $is_cn
79+
is_cn="1" bash script/build_and_push_images.sh "${{ matrix.build_target }}" "$image_name_cn" $is_cn
8080
# TODO: generate runtime yaml and json

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
.vscode
12
Language/rust/project/target/
Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
11
#!/bin/bash
2-
cd /home/devbox/project
3-
serve -s /home/devbox/project/dist/project/browser -l 3000
2+
app_env=${1:-development}
3+
4+
# Development environment commands
5+
dev_commands() {
6+
echo "Running Angular development server..."
7+
npm run start -- --host 0.0.0.0
8+
}
9+
10+
# Production environment commands
11+
prod_commands() {
12+
echo "Building Angular for production..."
13+
npm run build
14+
15+
echo "Setting up Express server for production..."
16+
17+
echo "Starting Express server on port 4200..."
18+
npm run start -- --host 0.0.0.0
19+
}
20+
21+
# Check environment variables to determine the running environment
22+
if [ "$app_env" = "production" ] || [ "$app_env" = "prod" ] ; then
23+
echo "Production environment detected"
24+
prod_commands
25+
else
26+
echo "Development environment detected"
27+
dev_commands
28+
fi

Framework/angular/v18/project/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"scripts": {
55
"ng": "ng",
6-
"start": "ng serve",
6+
"start": "ng serve --host=0.0.0.0 --port=4200",
77
"build": "ng build",
88
"watch": "ng build --watch --configuration development",
99
"test": "ng test"
Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
11
#!/bin/bash
2-
cd /home/devbox/project
3-
npm run start
2+
3+
app_env=${1:-development}
4+
5+
# Development environment commands
6+
dev_commands() {
7+
echo "Running Astro development environment..."
8+
npm run dev -- --host 0.0.0.0
9+
}
10+
11+
# Production environment commands
12+
prod_commands() {
13+
echo "Running Astro production environment..."
14+
npm run build
15+
echo "Starting Astro production server..."
16+
npm run preview -- --host 0.0.0.0
17+
}
18+
19+
# Check environment variables to determine the running environment
20+
if [ "$app_env" = "production" ] || [ "$app_env" = "prod" ] ; then
21+
echo "Production environment detected"
22+
prod_commands
23+
else
24+
echo "Development environment detected"
25+
dev_commands
26+
fi
Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
1-
./main
1+
#!/bin/bash
2+
3+
app_env=${1:-development}
4+
5+
# Define build target
6+
build_target="hello_world"
7+
8+
# Development environment commands
9+
dev_commands() {
10+
echo "Running development environment commands..."
11+
go run main.go
12+
}
13+
14+
# Production environment commands
15+
prod_commands() {
16+
echo "Running production environment commands..."
17+
go build -o $build_target main.go
18+
./$build_target
19+
}
20+
21+
# Check environment variables to determine the running environment
22+
if [ "$app_env" = "production" ] || [ "$app_env" = "prod" ] ; then
23+
echo "Production environment detected"
24+
prod_commands
25+
else
26+
echo "Development environment detected"
27+
dev_commands
28+
fi
Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1-
#!/bin/bash
2-
. bin/activate
3-
python manage.py runserver 0.0.0.0:8000
1+
#!/bin/bash
2+
3+
app_env=${1:-development}
4+
5+
# ※To use pip, parameters need to be added: --break-system-packages
6+
. bin/activate
7+
# Activate virtual environment
8+
9+
# Development environment commands
10+
dev_commands() {
11+
echo "Running development environment commands..."
12+
# In the development environment, we may need more debugging information
13+
python manage.py runserver 0.0.0.0:8000 --verbosity 2
14+
}
15+
16+
# Production environment commands
17+
prod_commands() {
18+
echo "Running production environment commands..."
19+
# In the production environment, we may need to add other parameters
20+
python manage.py runserver 0.0.0.0:8000
21+
}
22+
23+
# Check environment variables to determine the running environment
24+
if [ "$app_env" = "production" ] || [ "$app_env" = "prod" ] ; then
25+
echo "Production environment detected"
26+
prod_commands
27+
else
28+
echo "Development environment detected"
29+
dev_commands
30+
fi

Framework/django/4.2.16/project/project/settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
# SECURITY WARNING: don't run with debug turned on in production!
2626
DEBUG = True
2727

28-
ALLOWED_HOSTS = []
29-
28+
ALLOWED_HOSTS = ["*"]
3029

3130
# Application definition
3231

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
11
#!/bin/bash
2-
cd /home/devbox/project
3-
npm run serve
2+
app_env=${1:-development}
3+
4+
# Development environment commands
5+
dev_commands() {
6+
echo "Running Docusaurus development environment..."
7+
npm run start -- --host 0.0.0.0
8+
}
9+
10+
# Production environment commands
11+
prod_commands() {
12+
echo "Running Docusaurus production environment..."
13+
npm run build
14+
echo "Starting Docusaurus production server..."
15+
npm run serve -- --host 0.0.0.0
16+
}
17+
18+
# Check environment variables to determine the running environment
19+
if [ "$app_env" = "production" ] || [ "$app_env" = "prod" ] ; then
20+
echo "Production environment detected"
21+
prod_commands
22+
else
23+
echo "Development environment detected"
24+
dev_commands
25+
fi
Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
1-
./main
1+
#!/bin/bash
2+
3+
app_env=${1:-development}
4+
5+
# Define build target
6+
build_target="hello_world"
7+
8+
# Development environment commands
9+
dev_commands() {
10+
echo "Running development environment commands..."
11+
go run main.go
12+
}
13+
14+
# Production environment commands
15+
prod_commands() {
16+
echo "Running production environment commands..."
17+
go build -o $build_target main.go
18+
./$build_target
19+
}
20+
21+
# Check environment variables to determine the running environment
22+
if [ "$app_env" = "production" ] || [ "$app_env" = "prod" ] ; then
23+
echo "Production environment detected"
24+
prod_commands
25+
else
26+
echo "Development environment detected"
27+
dev_commands
28+
fi

0 commit comments

Comments
 (0)