mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 00:23:17 +00:00
feat: implement Docker Hub integration for building and pushing images in CI/CD workflow
This commit is contained in:
37
.github/workflows/docker-publish.yml
vendored
Normal file
37
.github/workflows/docker-publish.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# This GitHub Actions workflow builds and pushes Docker images to Docker Hub
|
||||||
|
# only when a GitHub release is published and the tag name contains 'latest'.
|
||||||
|
# The image is tagged as both the release tag and 'latest'.
|
||||||
|
|
||||||
|
|
||||||
|
name: Build and Push Docker Images (Release: latest only)
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image (only for releases with 'latest' in tag)
|
||||||
|
if: github.event_name == 'release' && contains(github.event.release.tag_name, 'latest')
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./application/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
arc53/docsgpt:${{ github.event.release.tag_name }}
|
||||||
|
arc53/docsgpt:latest
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
name: docsgpt-oss
|
name: docsgpt-oss
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
image: arc53/docsgpt:develop # some changes required here
|
image: arc53/docsgpt:latest
|
||||||
environment:
|
environment:
|
||||||
- VITE_API_HOST=http://localhost:7091
|
- VITE_API_HOST=http://localhost:7091
|
||||||
- VITE_API_STREAMING=$VITE_API_STREAMING
|
- VITE_API_STREAMING=$VITE_API_STREAMING
|
||||||
@@ -12,7 +12,7 @@ services:
|
|||||||
|
|
||||||
backend:
|
backend:
|
||||||
user: root
|
user: root
|
||||||
image: arc53/docsgpt:develop # some changes required here
|
image: arc53/docsgpt:latest
|
||||||
environment:
|
environment:
|
||||||
- API_KEY=$API_KEY
|
- API_KEY=$API_KEY
|
||||||
- EMBEDDINGS_KEY=$API_KEY
|
- EMBEDDINGS_KEY=$API_KEY
|
||||||
@@ -35,7 +35,7 @@ services:
|
|||||||
|
|
||||||
worker:
|
worker:
|
||||||
user: root
|
user: root
|
||||||
image: arc53/docsgpt:develop # some changes required here
|
image: arc53/docsgpt:latest
|
||||||
command: celery -A application.app.celery worker -l INFO -B
|
command: celery -A application.app.celery worker -l INFO -B
|
||||||
environment:
|
environment:
|
||||||
- API_KEY=$API_KEY
|
- API_KEY=$API_KEY
|
||||||
|
|||||||
27
setup.ps1
27
setup.ps1
@@ -9,7 +9,9 @@ $ErrorActionPreference = "Stop"
|
|||||||
|
|
||||||
# Get current script directory
|
# Get current script directory
|
||||||
$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||||
$COMPOSE_FILE = Join-Path -Path $SCRIPT_DIR -ChildPath "deployment\docker-compose-hub.yaml"
|
$COMPOSE_FILE_HUB = Join-Path -Path $SCRIPT_DIR -ChildPath "deployment\docker-compose-hub.yaml"
|
||||||
|
$COMPOSE_FILE_LOCAL = Join-Path -Path $SCRIPT_DIR -ChildPath "deployment\docker-compose.yaml"
|
||||||
|
$COMPOSE_FILE = $COMPOSE_FILE_HUB
|
||||||
$ENV_FILE = Join-Path -Path $SCRIPT_DIR -ChildPath ".env"
|
$ENV_FILE = Join-Path -Path $SCRIPT_DIR -ChildPath ".env"
|
||||||
|
|
||||||
# Function to write colored text
|
# Function to write colored text
|
||||||
@@ -223,12 +225,15 @@ function Prompt-MainMenu {
|
|||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-ColorText "Welcome to DocsGPT Setup!" -ForegroundColor "White" -Bold
|
Write-ColorText "Welcome to DocsGPT Setup!" -ForegroundColor "White" -Bold
|
||||||
Write-ColorText "How would you like to proceed?" -ForegroundColor "White"
|
Write-ColorText "How would you like to proceed?" -ForegroundColor "White"
|
||||||
Write-ColorText "1) Use DocsGPT Public API Endpoint (simple and free)" -ForegroundColor "Yellow"
|
Write-ColorText "1) Use DocsGPT Public API Endpoint (simple and free, uses pre-built Docker images from Docker Hub for fastest setup)" -ForegroundColor "Yellow"
|
||||||
Write-ColorText "2) Serve Local (with Ollama)" -ForegroundColor "Yellow"
|
Write-ColorText "2) Serve Local (with Ollama)" -ForegroundColor "Yellow"
|
||||||
Write-ColorText "3) Connect Local Inference Engine" -ForegroundColor "Yellow"
|
Write-ColorText "3) Connect Local Inference Engine" -ForegroundColor "Yellow"
|
||||||
Write-ColorText "4) Connect Cloud API Provider" -ForegroundColor "Yellow"
|
Write-ColorText "4) Connect Cloud API Provider" -ForegroundColor "Yellow"
|
||||||
|
Write-ColorText "5) Advanced: Build images locally (for developers)" -ForegroundColor "Yellow"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
$script:main_choice = Read-Host "Choose option (1-4)"
|
Write-ColorText "By default, DocsGPT uses pre-built images from Docker Hub for a fast, reliable, and consistent experience. This avoids local build errors and speeds up onboarding. Advanced users can choose to build images locally if needed." -ForegroundColor "White"
|
||||||
|
Write-Host ""
|
||||||
|
$script:main_choice = Read-Host "Choose option (1-5)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to prompt for Local Inference Engine options
|
# Function to prompt for Local Inference Engine options
|
||||||
@@ -737,13 +742,13 @@ while ($true) {
|
|||||||
|
|
||||||
switch ($main_choice) {
|
switch ($main_choice) {
|
||||||
"1" {
|
"1" {
|
||||||
|
$COMPOSE_FILE = $COMPOSE_FILE_HUB
|
||||||
Use-DocsPublicAPIEndpoint
|
Use-DocsPublicAPIEndpoint
|
||||||
$exitLoop = $true # Set flag to true on completion
|
$exitLoop = $true # Set flag to true on completion
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
"2" {
|
"2" {
|
||||||
Serve-LocalOllama
|
Serve-LocalOllama
|
||||||
# Only exit the loop if user didn't press "b" to go back
|
|
||||||
if ($ollama_choice -ne "b" -and $ollama_choice -ne "B") {
|
if ($ollama_choice -ne "b" -and $ollama_choice -ne "B") {
|
||||||
$exitLoop = $true
|
$exitLoop = $true
|
||||||
}
|
}
|
||||||
@@ -751,7 +756,6 @@ while ($true) {
|
|||||||
}
|
}
|
||||||
"3" {
|
"3" {
|
||||||
Connect-LocalInferenceEngine
|
Connect-LocalInferenceEngine
|
||||||
# Only exit the loop if user didn't press "b" to go back
|
|
||||||
if ($engine_choice -ne "b" -and $engine_choice -ne "B") {
|
if ($engine_choice -ne "b" -and $engine_choice -ne "B") {
|
||||||
$exitLoop = $true
|
$exitLoop = $true
|
||||||
}
|
}
|
||||||
@@ -759,20 +763,25 @@ while ($true) {
|
|||||||
}
|
}
|
||||||
"4" {
|
"4" {
|
||||||
Connect-CloudAPIProvider
|
Connect-CloudAPIProvider
|
||||||
# Only exit the loop if user didn't press "b" to go back
|
|
||||||
if ($provider_choice -ne "b" -and $provider_choice -ne "B") {
|
if ($provider_choice -ne "b" -and $provider_choice -ne "B") {
|
||||||
$exitLoop = $true
|
$exitLoop = $true
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
"5" {
|
||||||
|
Write-Host ""
|
||||||
|
Write-ColorText "You have selected to build images locally. This is recommended for developers or if you want to test local changes." -ForegroundColor "Yellow"
|
||||||
|
$COMPOSE_FILE = $COMPOSE_FILE_LOCAL
|
||||||
|
Use-DocsPublicAPIEndpoint
|
||||||
|
$exitLoop = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
default {
|
default {
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-ColorText "Invalid choice. Please choose 1-4." -ForegroundColor "Red"
|
Write-ColorText "Invalid choice. Please choose 1-5." -ForegroundColor "Red"
|
||||||
Start-Sleep -Seconds 1
|
Start-Sleep -Seconds 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Only break out of the loop if a function completed successfully
|
|
||||||
if ($exitLoop) {
|
if ($exitLoop) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
19
setup.sh
19
setup.sh
@@ -10,6 +10,7 @@ BOLD='\033[1m'
|
|||||||
|
|
||||||
# Base Compose file (relative to script location)
|
# Base Compose file (relative to script location)
|
||||||
COMPOSE_FILE="$(dirname "$(readlink -f "$0")")/deployment/docker-compose-hub.yaml"
|
COMPOSE_FILE="$(dirname "$(readlink -f "$0")")/deployment/docker-compose-hub.yaml"
|
||||||
|
COMPOSE_FILE_LOCAL="$(dirname "$(readlink -f "$0")")/deployment/docker-compose.yaml"
|
||||||
ENV_FILE="$(dirname "$(readlink -f "$0")")/.env"
|
ENV_FILE="$(dirname "$(readlink -f "$0")")/.env"
|
||||||
|
|
||||||
# Animation function
|
# Animation function
|
||||||
@@ -111,12 +112,15 @@ check_and_start_docker() {
|
|||||||
prompt_main_menu() {
|
prompt_main_menu() {
|
||||||
echo -e "\n${DEFAULT_FG}${BOLD}Welcome to DocsGPT Setup!${NC}"
|
echo -e "\n${DEFAULT_FG}${BOLD}Welcome to DocsGPT Setup!${NC}"
|
||||||
echo -e "${DEFAULT_FG}How would you like to proceed?${NC}"
|
echo -e "${DEFAULT_FG}How would you like to proceed?${NC}"
|
||||||
echo -e "${YELLOW}1) Use DocsGPT Public API Endpoint (simple and free)${NC}"
|
echo -e "${YELLOW}1) Use DocsGPT Public API Endpoint (simple and free, uses pre-built Docker images from Docker Hub for fastest setup)${NC}"
|
||||||
echo -e "${YELLOW}2) Serve Local (with Ollama)${NC}"
|
echo -e "${YELLOW}2) Serve Local (with Ollama)${NC}"
|
||||||
echo -e "${YELLOW}3) Connect Local Inference Engine${NC}"
|
echo -e "${YELLOW}3) Connect Local Inference Engine${NC}"
|
||||||
echo -e "${YELLOW}4) Connect Cloud API Provider${NC}"
|
echo -e "${YELLOW}4) Connect Cloud API Provider${NC}"
|
||||||
|
echo -e "${YELLOW}5) Advanced: Build images locally (for developers)${NC}"
|
||||||
echo
|
echo
|
||||||
read -p "$(echo -e "${DEFAULT_FG}Choose option (1-4): ${NC}")" main_choice
|
echo -e "${DEFAULT_FG}By default, DocsGPT uses pre-built images from Docker Hub for a fast, reliable, and consistent experience. This avoids local build errors and speeds up onboarding. Advanced users can choose to build images locally if needed.${NC}"
|
||||||
|
echo
|
||||||
|
read -p "$(echo -e "${DEFAULT_FG}Choose option (1-5): ${NC}")" main_choice
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to prompt for Local Inference Engine options
|
# Function to prompt for Local Inference Engine options
|
||||||
@@ -468,12 +472,14 @@ connect_cloud_api_provider() {
|
|||||||
# Main script execution
|
# Main script execution
|
||||||
animate_dino
|
animate_dino
|
||||||
|
|
||||||
|
|
||||||
while true; do # Main menu loop
|
while true; do # Main menu loop
|
||||||
clear # Clear screen before showing main menu again
|
clear # Clear screen before showing main menu again
|
||||||
prompt_main_menu
|
prompt_main_menu
|
||||||
|
|
||||||
case $main_choice in
|
case $main_choice in
|
||||||
1) # Use DocsGPT Public API Endpoint
|
1) # Use DocsGPT Public API Endpoint (Docker Hub images)
|
||||||
|
COMPOSE_FILE="$(dirname "$(readlink -f "$0")")/deployment/docker-compose-hub.yaml"
|
||||||
use_docs_public_api_endpoint
|
use_docs_public_api_endpoint
|
||||||
break ;;
|
break ;;
|
||||||
2) # Serve Local (with Ollama)
|
2) # Serve Local (with Ollama)
|
||||||
@@ -485,8 +491,13 @@ while true; do # Main menu loop
|
|||||||
4) # Connect Cloud API Provider
|
4) # Connect Cloud API Provider
|
||||||
connect_cloud_api_provider
|
connect_cloud_api_provider
|
||||||
break ;;
|
break ;;
|
||||||
|
5) # Advanced: Build images locally
|
||||||
|
echo -e "\n${YELLOW}You have selected to build images locally. This is recommended for developers or if you want to test local changes.${NC}"
|
||||||
|
COMPOSE_FILE="$COMPOSE_FILE_LOCAL"
|
||||||
|
use_docs_public_api_endpoint
|
||||||
|
break ;;
|
||||||
*)
|
*)
|
||||||
echo -e "\n${RED}Invalid choice. Please choose 1-4.${NC}" ; sleep 1 ;;
|
echo -e "\n${RED}Invalid choice. Please choose 1-5.${NC}" ; sleep 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user