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:
parent
98385ea743
commit
efca2b5941
1 changed files with 7 additions and 1 deletions
|
|
@ -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}" \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue