qbhf2 commited on
Commit
6d67087
·
verified ·
1 Parent(s): bb3d7b0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -8
Dockerfile CHANGED
@@ -29,7 +29,7 @@ RUN /opt/blender-${BLENDER_VERSION}-linux-x64/${BLENDER_MAJOR}/python/bin/python
29
  /opt/blender-${BLENDER_VERSION}-linux-x64/${BLENDER_MAJOR}/python/bin/python3.11 -m pip install --no-cache-dir Pillow
30
 
31
  # -------- Runtime: fetch private repo, install, run app.py --------
32
- # Required Space settings:
33
  # Secret: GIT_TOKEN (PAT with repo read access)
34
  # Variable: GIT_REPO (chaous/render OR https://github.com/chaous/render.git)
35
  # Variable: GIT_REF (optional, default "main")
@@ -49,20 +49,32 @@ RUN printf '%s\n' \
49
  ' echo "[error] GIT_REPO and GIT_TOKEN must be set." >&2; exit 1' \
50
  'fi' \
51
  '' \
52
- '# Normalize repo to a full HTTPS URL if needed' \
53
  'if [[ "${REPO}" == *"://"* ]]; then' \
54
- ' GIT_URL="${REPO}"' \
55
  'else' \
56
- ' GIT_URL="https://github.com/${REPO}.git"' \
57
  'fi' \
58
  '' \
59
- 'echo "[info] Cloning ${GIT_URL}@${REF} into ${TARGET_ROOT}..."' \
 
 
 
 
 
 
 
 
 
 
60
  'rm -rf "${TARGET_ROOT}"' \
61
  'mkdir -p "${TARGET_ROOT}"' \
62
- 'chmod -R 777 "${TARGET_ROOT}" || true' \
63
  '' \
64
- '# Use header auth (no token in URL or logs)' \
65
- 'git -c http.extraHeader="Authorization: token ${GIT_TOKEN}" clone --depth 1 --branch "${REF}" "${GIT_URL}" "${TARGET_ROOT}"' \
 
 
 
66
  '' \
67
  'if [[ -n "${SUBDIR}" ]]; then' \
68
  ' if [[ -d "${TARGET_ROOT}/${SUBDIR}" ]]; then' \
 
29
  /opt/blender-${BLENDER_VERSION}-linux-x64/${BLENDER_MAJOR}/python/bin/python3.11 -m pip install --no-cache-dir Pillow
30
 
31
  # -------- Runtime: fetch private repo, install, run app.py --------
32
+ # Required in Space settings:
33
  # Secret: GIT_TOKEN (PAT with repo read access)
34
  # Variable: GIT_REPO (chaous/render OR https://github.com/chaous/render.git)
35
  # Variable: GIT_REF (optional, default "main")
 
49
  ' echo "[error] GIT_REPO and GIT_TOKEN must be set." >&2; exit 1' \
50
  'fi' \
51
  '' \
52
+ '# Normalize to full GitHub HTTPS URL' \
53
  'if [[ "${REPO}" == *"://"* ]]; then' \
54
+ ' BASE_URL="${REPO}"' \
55
  'else' \
56
+ ' BASE_URL="https://github.com/${REPO}.git"' \
57
  'fi' \
58
  '' \
59
+ '# Build auth URL (token in URL avoids interactive prompts). Use x-access-token as user.' \
60
+ 'if [[ "${BASE_URL}" == https://github.com/* ]]; then' \
61
+ ' AUTH_URL="${BASE_URL/https:\/\//https:\/\/x-access-token:${GIT_TOKEN}@}"' \
62
+ ' SAN_URL="${BASE_URL}"' \
63
+ 'else' \
64
+ ' # Non-GitHub host: fall back to header-based clone' \
65
+ ' AUTH_URL="${BASE_URL}"' \
66
+ ' SAN_URL="${BASE_URL}"' \
67
+ 'fi' \
68
+ '' \
69
+ 'echo "[info] Cloning ${SAN_URL}@${REF} into ${TARGET_ROOT}..."' \
70
  'rm -rf "${TARGET_ROOT}"' \
71
  'mkdir -p "${TARGET_ROOT}"' \
 
72
  '' \
73
+ 'if [[ "${BASE_URL}" == https://github.com/* ]]; then' \
74
+ ' git clone --depth 1 --branch "${REF}" "${AUTH_URL}" "${TARGET_ROOT}"' \
75
+ 'else' \
76
+ ' git -c http.extraHeader="Authorization: Bearer ${GIT_TOKEN}" clone --depth 1 --branch "${REF}" "${AUTH_URL}" "${TARGET_ROOT}"' \
77
+ 'fi' \
78
  '' \
79
  'if [[ -n "${SUBDIR}" ]]; then' \
80
  ' if [[ -d "${TARGET_ROOT}/${SUBDIR}" ]]; then' \