fullpwerr commited on
Commit
39f5335
·
1 Parent(s): 156bdd3

Update Dockerfile and utils.py to improve cache handling and directory structure

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -4
  2. 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
- # ==== FIX CACHE ====
21
- RUN mkdir -p /tmp && chmod -R 777 /tmp
22
- ENV XDG_CACHE_HOME="/tmp"
23
- ENV PATH="/usr/bin/chromedriver:${PATH}"
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
- # Redirect cache to /tmp biar gak error permission
8
- os.environ['XDG_CACHE_HOME'] = "/tmp"
 
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()