Update immich/install.sh
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 8s

This commit is contained in:
j
2026-01-15 11:35:50 +13:00
parent 10ec03d1e8
commit 8d4f24af4e

View File

@@ -14,22 +14,26 @@ WEB_PORT="${WEB_PORT:-2283}"
DB_USERNAME="${DB_USERNAME:-postgres}"
DB_DATABASE_NAME="${DB_DATABASE_NAME:-immich}"
# Export all variables for envsubst
export CONTAINER_NAME UPLOAD_LOCATION DB_DATA_LOCATION DB_PASSWORD DB_USERNAME DB_DATABASE_NAME
export WEB_PORT IMMICH_VERSION ML_IMAGE_TAG
cd "$SCRIPT_DIR" || _die "Failed to change to script directory"
# Generate docker-compose.yml from template
# Generate docker-compose.yml from template using sed
echo "Generating docker-compose.yml..."
envsubst < docker-compose.yml.template > docker-compose.yml \
sed -e "s|\${CONTAINER_NAME}|${CONTAINER_NAME}|g" \
-e "s|\${UPLOAD_LOCATION}|${UPLOAD_LOCATION}|g" \
-e "s|\${DB_DATA_LOCATION}|${DB_DATA_LOCATION}|g" \
-e "s|\${DB_PASSWORD}|${DB_PASSWORD}|g" \
-e "s|\${DB_USERNAME}|${DB_USERNAME}|g" \
-e "s|\${DB_DATABASE_NAME}|${DB_DATABASE_NAME}|g" \
-e "s|\${WEB_PORT}|${WEB_PORT}|g" \
-e "s|\${IMMICH_VERSION}|${IMMICH_VERSION}|g" \
-e "s|\${ML_IMAGE_TAG}|${ML_IMAGE_TAG}|g" \
docker-compose.yml.template > docker-compose.yml \
|| _die "Failed to generate docker-compose.yml"
# Add GPU configuration if enabled
if [ "$ML_GPU_ENABLED" = "true" ]; then
echo "Enabling GPU acceleration..."
GPU_CONFIG=" devices:\n - /dev/dri:/dev/dri"
sed -i "s|#GPU_PLACEHOLDER#|${GPU_CONFIG}|" docker-compose.yml
sed -i 's|#GPU_PLACEHOLDER#| devices:\n - /dev/dri:/dev/dri|' docker-compose.yml
else
# Remove the placeholder
sed -i '/#GPU_PLACEHOLDER#/d' docker-compose.yml