Download entrypoint.sh from 000x/sinhala: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/000x/sinhala/resolve/main/entrypoint.sh
- Command line
-
hf download hf://spaces/000x/sinhala/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/000x/sinhala/resolve/main/entrypoint.sh
1.99 kB
| set -eu | |
| # βββββββββββββββββββββββββββββββββββββββββ | |
| # Required secrets | |
| # βββββββββββββββββββββββββββββββββββββββββ | |
| : "${GIT_REPO_URL:?GIT_REPO_URL secret is required}" | |
| : "${GIT_TOKEN:?GIT_TOKEN secret is required}" | |
| GIT_HOST="${GIT_HOST:-github.com}" | |
| GIT_USERNAME="${GIT_USERNAME:-x-access-token}" | |
| APP_DIR="/app/src" | |
| CREDS="/tmp/git-credentials" | |
| cleanup() { | |
| rm -f "$CREDS" || true | |
| } | |
| trap cleanup EXIT | |
| rm -rf "$APP_DIR" | |
| mkdir -p "$APP_DIR" | |
| # βββββββββββββββββββββββββββββββββββββββββ | |
| # Secure git credential setup | |
| # Token is written to a temp file, not printed. | |
| # βββββββββββββββββββββββββββββββββββββββββ | |
| umask 077 | |
| printf 'https://%s:%s@%s\n' "$GIT_USERNAME" "$GIT_TOKEN" "$GIT_HOST" > "$CREDS" | |
| git config --global credential.helper "store --file=$CREDS" | |
| # βββββββββββββββββββββββββββββββββββββββββ | |
| # Clone private repository | |
| # βββββββββββββββββββββββββββββββββββββββββ | |
| git clone --depth 1 "$GIT_REPO_URL" "$APP_DIR" | |
| # Remove credential file and helper after clone | |
| rm -f "$CREDS" | |
| git config --global --unset credential.helper || true | |
| # βββββββββββββββββββββββββββββββββββββββββ | |
| # Install dependencies and start app | |
| # βββββββββββββββββββββββββββββββββββββββββ | |
| cd "$APP_DIR" | |
| python -m pip install --no-cache-dir -r requirements.txt | |
| exec python -m uvicorn app:app \ | |
| --host 0.0.0.0 \ | |
| --port "${PORT:-7860}" |