x2XcarleX2x commited on
Commit
1e7ad66
·
verified ·
1 Parent(s): 50563c9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +55 -0
Dockerfile CHANGED
@@ -162,6 +162,61 @@ COPY requirements.txt .
162
  RUN pip install -r requirements.txt
163
 
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  # =============================================================================
166
  # COPIA O CÓDIGO DA APLICAÇÃO E CONFIGURA PERMISSÕES
167
  # =============================================================================
 
162
  RUN pip install -r requirements.txt
163
 
164
 
165
+ # ===== Diffusers auto-update (simples) =====
166
+ DIFFUSERS_FORK_URL="${DIFFUSERS_FORK_URL:-https://github.com/carlex22/diffusers-aduc-sdr}"
167
+ DIFFUSERS_BRANCH="${DIFFUSERS_BRANCH:-main}"
168
+
169
+ echo "🔄 Checando fork Diffusers (${DIFFUSERS_BRANCH})..."
170
+
171
+ INSTALLED_SHA="$(python3 - <<'PY'
172
+ import json
173
+ from importlib.metadata import distribution, PackageNotFoundError
174
+ sha = ""
175
+ try:
176
+ dist = distribution("diffusers")
177
+ try:
178
+ s = dist.read_text("direct_url.json")
179
+ if s:
180
+ j = json.loads(s)
181
+ sha = (j.get("vcs_info") or {}).get("commit_id") or ""
182
+ except Exception:
183
+ pass
184
+ except PackageNotFoundError:
185
+ pass
186
+ print(sha, end="")
187
+ PY
188
+ )"
189
+ echo "📦 Commit instalado: ${INSTALLED_SHA:-<none>}"
190
+
191
+ REMOTE_SHA="$(python3 - <<'PY'
192
+ import json, os, sys, urllib.request
193
+ repo = os.environ.get("DIFFUSERS_FORK_URL","https://github.com/carlex22/diffusers-aduc-sdr").replace("https://github.com/","")
194
+ branch = os.environ.get("DIFFUSERS_BRANCH","main")
195
+ url = f"https://api.github.com/repos/{repo}/commits/{branch}"
196
+ req = urllib.request.Request(url)
197
+ tok = os.environ.get("GH_TOKEN")
198
+ if tok:
199
+ req.add_header("Authorization", f"Bearer {tok}")
200
+ try:
201
+ with urllib.request.urlopen(req, timeout=10) as r:
202
+ data = json.loads(r.read().decode("utf-8"))
203
+ print(data.get("sha",""), end="")
204
+ except Exception:
205
+ print("", end="")
206
+ PY
207
+ )"
208
+ echo "🌐 Commit remoto: ${REMOTE_SHA:-<none>}"
209
+
210
+ if [ -z "${INSTALLED_SHA}" ] || [ -z "${REMOTE_SHA}" ] || [ "${INSTALLED_SHA}" != "${REMOTE_SHA}" ]; then
211
+ echo "⬇️ Atualizando diffusers do fork (${DIFFUSERS_BRANCH})..."
212
+ pip install --upgrade --no-deps --no-cache-dir "git+${DIFFUSERS_FORK_URL}@${DIFFUSERS_BRANCH}"
213
+ else
214
+ echo "✅ Diffusers já está atualizado."
215
+ fi
216
+ # ===== fim =====
217
+
218
+
219
+
220
  # =============================================================================
221
  # COPIA O CÓDIGO DA APLICAÇÃO E CONFIGURA PERMISSÕES
222
  # =============================================================================