Spaces:
Paused
Paused
Update Dockerfile
Browse files- 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
|
| 53 |
'if [[ "${REPO}" == *"://"* ]]; then' \
|
| 54 |
-
'
|
| 55 |
'else' \
|
| 56 |
-
'
|
| 57 |
'fi' \
|
| 58 |
'' \
|
| 59 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
'rm -rf "${TARGET_ROOT}"' \
|
| 61 |
'mkdir -p "${TARGET_ROOT}"' \
|
| 62 |
-
'chmod -R 777 "${TARGET_ROOT}" || true' \
|
| 63 |
'' \
|
| 64 |
-
'
|
| 65 |
-
'git
|
|
|
|
|
|
|
|
|
|
| 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' \
|