diff --git a/devbox/cli/devbox b/devbox/cli/devbox index f272222..6f172a7 100755 --- a/devbox/cli/devbox +++ b/devbox/cli/devbox @@ -640,6 +640,38 @@ init_compile_env() { # Update for export environments [] docker exec -i "$DEVBOX_NAME" bash < /dev/null 2>&1; then + echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Google is accessible, using default Ubuntu sources" + # Use the default Ubuntu source without any modifications + echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Keeping default Ubuntu sources" + else + echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Google is not accessible, switching to Aliyun mirrors" + # Back up the original source list + cp /etc/apt/sources.list /etc/apt/sources.list.backup + echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Backup original sources.list to sources.list.backup" + + # Replace with an Alibaba Cloud mirror source + cat > /etc/apt/sources.list << 'SOURCES_EOF' +deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse +SOURCES_EOF + echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Successfully replaced with Aliyun mirrors" + fi + + # Update package list + echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Updating package lists..." + apt-get update + echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Starting DevBox initialization..." # Export environment variables @@ -988,7 +1020,7 @@ compile_backend_service() { # Check if it's the first time by verifying if the backend dependencies have been installed if [ ! -f "/home/devbox/.backend_deps_installed" ]; then echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Install backend dependencies..." - pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt + pip install --no-cache-dir -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt if ! pip show async_timeout; then echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') async_timeout is missing. Installing..." pip install async_timeout @@ -1034,7 +1066,7 @@ compile_backend_service() { if [ \$IS_NEW_REQ_ADDED -eq 1 ]; then echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Reinstalling dependencies..." - pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt + pip install --no-cache-dir -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt fi # Undo update for /home/devbox/freeleaps/apps/requirements.txt rm /home/devbox/freeleaps/apps/freeleaps/requirements.txt @@ -1048,7 +1080,7 @@ compile_backend_service() { # Check if all dependencies are installed, if not, install them if ! pip check; then echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Some dependencies are missing. Reinstalling..." - pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt + pip install --no-cache-dir -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt fi # pip install async_timeout if not installed @@ -1094,7 +1126,7 @@ compile_backend_service() { if [ \$IS_NEW_REQ_ADDED -eq 1 ]; then echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Reinstalling dependencies..." - pip install -r /home/devbox/freeleaps/apps/requirements.txt + pip install --no-cache-dir -r /home/devbox/freeleaps/apps/requirements.txt fi # Undo update for /home/devbox/freeleaps/apps/requirements.txt @@ -3582,7 +3614,9 @@ devbox_init_parse_requirements() { add_arg '--devbox-image-name' "devbox_v1" fi - if [ -z "$(get_arg '--devbox-image-tag')" ]; then + if [ "$current_arch" = "amd64" ]; then + add_arg '--devbox-image-tag' "devbox_local_amd64" + else add_arg '--devbox-image-tag' "devbox_local" fi