Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 43994f9

Browse files
committed
feat: allow to expose vllm_ur as parameter in Docker
Closes: #239
1 parent e44fbe9 commit 43994f9

File tree

2 files changed

+49
-17
lines changed

2 files changed

+49
-17
lines changed

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ EXPOSE 80
9898
# Set the PYTHONPATH environment variable
9999
ENV PYTHONPATH=/app/src
100100

101+
# Define an argument for vlm_url with a default value
102+
ARG VLLM_URL=https://inference.codegate.ai
103+
ENV VLLM_URL=${VLLM_URL}
104+
101105
# Set the container's default entrypoint
102106
EXPOSE 8989
103-
ENTRYPOINT ["/app/scripts/entrypoint.sh", "/tmp/weaviate_backup", "backup"]
107+
ENTRYPOINT ["/app/scripts/entrypoint.sh", "${VLLM_URL}", "/tmp/weaviate_backup", "backup"]

scripts/entrypoint.sh

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,46 @@
11
#!/bin/bash
22

3-
# Check if the backup directory exists and handle the restore
4-
if [ -d "$1" ] && [ -d "$1/$2" ]; then
5-
echo "Restoring backup from $1/$2..."
6-
# Your restore logic here, e.g., running a Python script or restoring a database
7-
python -m src.codegate.cli restore-backup --backup-path "$1" --backup-name "$2"
8-
else
9-
echo "No backup found at $1/$2. Skipping restore."
10-
fi
11-
12-
# Step 2: Start the Nginx server with FE
13-
echo "Starting the dashboard.. "
14-
exec nginx -g 'daemon off;' &
15-
16-
# Step 3: Start the main application (serve)
17-
echo "Starting the application..."
18-
exec python -m src.codegate.cli serve --port 8989 --host 0.0.0.0 --vllm-url https://inference.codegate.ai --model-base-path /app/models
3+
DEFAULT_VLLM_URL="https://inference.codegate.ai"
4+
5+
# Parse arguments
6+
VLLM_URL=${1:-$DEFAULT_VLLM_URL}
7+
BACKUP_PATH=$2
8+
BACKUP_MODE=$3
9+
10+
# Function to restore backup if paths are provided
11+
restore_backup() {
12+
if [ -n "$BACKUP_PATH" ] && [ -n "$BACKUP_MODE" ]; then
13+
if [ -d "$BACKUP_PATH" ] && [ -d "$BACKUP_PATH/$BACKUP_MODE" ]; then
14+
echo "Restoring backup from $BACKUP_PATH/$BACKUP_MODE..."
15+
python -m src.codegate.cli restore-backup --backup-path "$BACKUP_PATH" --backup-name "$BACKUP_MODE"
16+
else
17+
echo "No backup found at $BACKUP_PATH/$BACKUP_MODE. Skipping restore."
18+
fi
19+
else
20+
echo "Backup path or mode not provided. Skipping restore."
21+
fi
22+
}
23+
24+
# Function to start Nginx server for the dashboard
25+
start_dashboard() {
26+
echo "Starting the dashboard..."
27+
nginx -g 'daemon off;' &
28+
}
29+
30+
# Function to start the main application
31+
start_application() {
32+
echo "Starting the application with VLLM URL: $VLLM_URL"
33+
exec python -m src.codegate.cli serve --port 8989 --host 0.0.0.0 --vllm-url "$VLLM_URL" --model-base-path /app/models
34+
}
35+
36+
# Main execution flow
37+
echo "Initializing entrypoint script..."
38+
39+
# Step 1: Restore backup if applicable
40+
restore_backup
41+
42+
# Step 2: Start the dashboard
43+
start_dashboard
44+
45+
# Step 3: Start the main application
46+
start_application

0 commit comments

Comments
 (0)