build.sh: skip --env-file when env file does not exist

docker run fails hard if the path passed to --env-file is missing.
Make the flag conditional so apps without an env file (or where the
file hasn't been created yet) still start successfully.

https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
This commit is contained in:
Claude 2026-03-19 09:46:59 +00:00
parent 98385ea743
commit efca2b5941
No known key found for this signature in database

View file

@ -90,10 +90,16 @@ fi
# ── 5. Start new container ────────────────────────────────────────────────────
log "Starting container ${CONTAINER_NAME}"
ENV_FILE_ARG=()
if [ -n "${ENV_FILE:-}" ] && [ -f "$ENV_FILE" ]; then
ENV_FILE_ARG=(--env-file "$ENV_FILE")
else
log "No env file found at '${ENV_FILE:-}'; starting without one."
fi
docker run --detach \
--name "$CONTAINER_NAME" \
--network hiy-net \
--env-file "$ENV_FILE" \
"${ENV_FILE_ARG[@]}" \
--expose "$PORT" \
--label "hiy.app=${APP_ID}" \
--label "hiy.port=${PORT}" \