Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@ __pycache__/

FILES/*
.gitmodules
!FILES/sample.txt
!FILES/sample.txt

# Ignore .last_build_timestamp because it stores the timestamp of the last Docker build and should not be version controlled.
.last_build_timestamp

# Ignore doc directory,because it is test doc.
/doc
23 changes: 20 additions & 3 deletions docker.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
#!/bin/sh

# Name of the image
IMAGE_NAME="kaguya"

# File to store the timestamp of the last build
TIMESTAMP_FILE=".last_build_timestamp"

# Get the modification timestamp of Dockerfile
MOD_TIMESTAMP=$(date -r Dockerfile +%s)

# Get Git user name and email from host machine
GIT_NAME=$(git config --get user.name)
GIT_EMAIL=$(git config --get user.email)

# Build the Docker image
docker build --build-arg GIT_NAME="$GIT_NAME" --build-arg GIT_EMAIL="$GIT_EMAIL" -t kaguya .
# Check if the image already exists and if the timestamp has changed
if [ "$(docker images -q $IMAGE_NAME 2> /dev/null)" == "" ] || [ ! -f "$TIMESTAMP_FILE" ] || [ "$MOD_TIMESTAMP" -gt "$(cat $TIMESTAMP_FILE)" ]; then
echo "Building the image..."
# Build the Docker image
docker build --build-arg GIT_NAME="$GIT_NAME" --build-arg GIT_EMAIL="$GIT_EMAIL" -t $IMAGE_NAME .
# Store the modification timestamp of Dockerfile
echo "$MOD_TIMESTAMP" > $TIMESTAMP_FILE
else
echo "Image exists and is up to date. Starting container..."
fi

# Run the Docker container with the --rm flag (automatically remove container on exit)
docker run --shm-size=2g --rm -p 3000:3000 -v $(pwd):/kaguya -v /kaguya/node_modules kaguya
docker run --shm-size=2g --rm -p 9999:3000 -v $(pwd):/kaguya -v /kaguya/node_modules $IMAGE_NAME
2 changes: 1 addition & 1 deletion public/.well-known/ai-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"api": {
"type": "openapi",
"url": "http://localhost:3000/openapi.yaml",
"url": "http://localhost:9999/openapi.yaml",
"is_user_authenticated": false
},
"logo_url": "https://images.squarespace-cdn.com/content/v1/59518b28cd0f684eae15259e/c8be2bdb-dd07-43ff-a268-db52c39925b0/csdlogo.jpg",
Expand Down
2 changes: 1 addition & 1 deletion public/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ info:
description: A project that you can edit just by talking to ChatGPT.
version: v1
servers:
- url: http://localhost:3000
- url: http://localhost:9999
paths:
/api/executeCommand:
post:
Expand Down