1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-08 23:07:06 +02:00

fix: devcontainer paths/logs (#19236)

This commit is contained in:
Min Idzelis
2025-06-17 16:52:57 -04:00
committed by GitHub
parent 91cbd56c1c
commit c6641d4859
6 changed files with 59 additions and 25 deletions

View File

@ -7,12 +7,34 @@ export DEV_PORT="${DEV_PORT:-3000}"
# Devcontainer: Clone [repository|pull request] in container volumne
WORKSPACES_DIR="/workspaces"
IMMICH_DIR="$WORKSPACES_DIR/immich"
IMMICH_DEVCONTAINER_LOG="$HOME/immich-devcontainer.log"
log() {
# Display command on console, log with timestamp to file
echo "$*"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" >>"$IMMICH_DEVCONTAINER_LOG"
}
run_cmd() {
# Ensure log directory exists
mkdir -p "$(dirname "$IMMICH_DEVCONTAINER_LOG")"
log "$@"
# Execute command: display normally on console, log with timestamps to file
"$@" 2>&1 | tee >(while IFS= read -r line; do
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $line" >>"$IMMICH_DEVCONTAINER_LOG"
done)
# Preserve exit status
return "${PIPESTATUS[0]}"
}
# Find directories excluding /workspaces/immich
mapfile -t other_dirs < <(find "$WORKSPACES_DIR" -mindepth 1 -maxdepth 1 -type d ! -path "$IMMICH_DIR" ! -name ".*")
if [ ${#other_dirs[@]} -gt 1 ]; then
echo "Error: More than one directory found in $WORKSPACES_DIR other than $IMMICH_DIR."
log "Error: More than one directory found in $WORKSPACES_DIR other than $IMMICH_DIR."
exit 1
elif [ ${#other_dirs[@]} -eq 1 ]; then
export IMMICH_WORKSPACE="${other_dirs[0]}"
@ -20,16 +42,12 @@ else
export IMMICH_WORKSPACE="$IMMICH_DIR"
fi
echo "Found immich workspace in $IMMICH_WORKSPACE"
run_cmd() {
echo "$@"
"$@"
}
log "Found immich workspace in $IMMICH_WORKSPACE"
log ""
fix_permissions() {
echo "Fixing permissions for ${IMMICH_WORKSPACE}"
log "Fixing permissions for ${IMMICH_WORKSPACE}"
run_cmd sudo find "${IMMICH_WORKSPACE}/server/upload" -not -path "${IMMICH_WORKSPACE}/server/upload/postgres/*" -not -path "${IMMICH_WORKSPACE}/server/upload/postgres" -exec chown node {} +
@ -41,17 +59,19 @@ fix_permissions() {
"${IMMICH_WORKSPACE}/server/dist" \
"${IMMICH_WORKSPACE}/web/node_modules" \
"${IMMICH_WORKSPACE}/web/dist"
log ""
}
install_dependencies() {
echo "Installing dependencies"
log "Installing dependencies"
(
cd "${IMMICH_WORKSPACE}" || exit 1
run_cmd make install-server
run_cmd make install-open-api
run_cmd make build-open-api
run_cmd make install-sdk
run_cmd make build-sdk
run_cmd make install-web
)
}
log ""
}