Spaces:
Paused
Paused
Update Dockerfile and utils.py to improve cache handling and directory structure
Browse files- Dockerfile +4 -4
- app/utils.py +3 -2
Dockerfile
CHANGED
|
@@ -17,10 +17,10 @@ RUN wget -q https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/138.0.72
|
|
| 17 |
chmod +x /usr/bin/chromedriver && \
|
| 18 |
rm -rf chromedriver-linux64*
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
|
| 25 |
# ==== INSTALL PYTHON DEPS ====
|
| 26 |
WORKDIR /app
|
|
|
|
| 17 |
chmod +x /usr/bin/chromedriver && \
|
| 18 |
rm -rf chromedriver-linux64*
|
| 19 |
|
| 20 |
+
|
| 21 |
+
# Buat /tmp/.cache dan symlink / → /tmp
|
| 22 |
+
RUN mkdir -p /tmp/.cache /tmp/.config && chmod -R 777 /tmp
|
| 23 |
+
RUN ln -s /tmp/.cache /.cache || true
|
| 24 |
|
| 25 |
# ==== INSTALL PYTHON DEPS ====
|
| 26 |
WORKDIR /app
|
app/utils.py
CHANGED
|
@@ -4,8 +4,9 @@ from selenium.webdriver.chrome.options import Options
|
|
| 4 |
from selenium.webdriver.common.by import By
|
| 5 |
import time
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
os.environ[
|
|
|
|
| 9 |
|
| 10 |
def bypass_shinigami(url: str) -> str:
|
| 11 |
chrome_options = Options()
|
|
|
|
| 4 |
from selenium.webdriver.common.by import By
|
| 5 |
import time
|
| 6 |
|
| 7 |
+
# Force all cache to go to /tmp/.cache
|
| 8 |
+
os.environ["XDG_CACHE_HOME"] = "/tmp/.cache"
|
| 9 |
+
os.environ["XDG_CONFIG_HOME"] = "/tmp/.config"
|
| 10 |
|
| 11 |
def bypass_shinigami(url: str) -> str:
|
| 12 |
chrome_options = Options()
|