chouchouvs commited on
Commit
5f8d187
·
verified ·
1 Parent(s): 3fa5250

Delete entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +0 -72
entrypoint.sh DELETED
@@ -1,72 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # --- Réglages (surchageables en Variables ou Secrets HF) ---
5
- : "${GITHUB_REPO_API_URL:=https://github.com/chourmovs/RFPmasterApi.git}"
6
- : "${GITHUB_REPO_CORE_URL:=https://github.com/chourmovs/RFPmaster.git}"
7
- : "${GITHUB_TOKEN:=}" # si besoin pour repos privés
8
- : "${API_MODULE:=rfp_api_app}" # doit exposer "app"
9
- : "${API_APP_ATTR:=app}"
10
- : "${BRANCH_API:=}" # ex: main ; vide = HEAD par défaut
11
- : "${BRANCH_CORE:=}" # ex: main
12
- : "${WORKSPACE:=/home/user/workspace}"
13
-
14
- # --- Dossiers de clone ---
15
- API_DIR="${WORKSPACE}/RFPmasterApi"
16
- CORE_DIR="${WORKSPACE}/RFPmaster" # contiendra rfp_parser/
17
-
18
- echo "[startup] WORKSPACE=${WORKSPACE}"
19
- mkdir -p "${WORKSPACE}"
20
-
21
- clone_or_update () {
22
- local repo_url="$1" target="$2" branch="$3"
23
-
24
- if [ ! -d "${target}/.git" ]; then
25
- echo "[git] cloning ${repo_url} -> ${target}"
26
- if [ -n "${GITHUB_TOKEN}" ]; then
27
- git -c http.extraHeader="Authorization: Basic $(printf 'oauth2:%s' "${GITHUB_TOKEN}" | base64 -w0)" \
28
- clone --depth=1 ${branch:+-b "${branch}"} "${repo_url}" "${target}"
29
- else
30
- git clone --depth=1 ${branch:+-b "${branch}"} "${repo_url}" "${target}"
31
- fi
32
- else
33
- echo "[git] updating ${target}"
34
- git -C "${target}" fetch --depth=1 origin
35
- if [ -n "${branch}" ]; then
36
- git -C "${target}" checkout -q "${branch}" || true
37
- fi
38
- git -C "${target}" reset --hard ${branch:+origin/"${branch}"} ${branch:+"$(true)"} || git -C "${target}" reset --hard origin/HEAD
39
- fi
40
- }
41
-
42
- # --- Clone/update des deux repos ---
43
- clone_or_update "${GITHUB_REPO_API_URL}" "${API_DIR}" "${BRANCH_API}"
44
- clone_or_update "${GITHUB_REPO_CORE_URL}" "${CORE_DIR}" "${BRANCH_CORE}"
45
-
46
- # Safe dir pour Git (HF)
47
- git config --global --add safe.directory "${API_DIR}" || true
48
- git config --global --add safe.directory "${CORE_DIR}" || true
49
-
50
- # --- PYTHONPATH : on expose les deux répertoires ---
51
- export PYTHONPATH="${API_DIR}:${CORE_DIR}:${PYTHONPATH:-}"
52
-
53
- # --- Sanity checks imports ---
54
- echo "[check] importing ${API_MODULE}"
55
- python - <<'PY' "${API_MODULE}"
56
- import importlib, sys
57
- m = sys.argv[1]
58
- importlib.import_module(m)
59
- print(f"[check] import {m}: OK")
60
- PY
61
-
62
- echo "[check] importing rfp_parser"
63
- python - <<'PY'
64
- import importlib
65
- importlib.import_module("rfp_parser")
66
- print("[check] import rfp_parser: OK")
67
- PY
68
-
69
- # --- Lancement Uvicorn ---
70
- cd "${API_DIR}"
71
- echo "[uvicorn] launching ${API_MODULE}:${API_APP_ATTR} on 0.0.0.0:7860"
72
- exec uvicorn "${API_MODULE}:${API_APP_ATTR}" --host 0.0.0.0 --port 7860