Cnass commited on
Commit
d6330de
·
verified ·
1 Parent(s): f00c16d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -18
Dockerfile CHANGED
@@ -1,30 +1,39 @@
1
  FROM mcr.microsoft.com/dotnet/sdk:8.0
2
  WORKDIR /app
3
 
 
4
  RUN apt-get update && apt-get install -y python3 python3-pip wget unzip curl
5
 
6
  COPY requirements.txt .
7
  RUN pip3 install --no-cache-dir -r requirements.txt --break-system-packages
8
 
9
- # API Rate Limit (403/Null) engellerini aşmak için insan gibi davranan Python HTML Kazıyıcısı
10
- RUN python3 -c "import urllib.request, re, sys; \
11
- headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'}; \
12
- req = urllib.request.Request('https://github.com/UnderminersTeam/UndertaleModTool/releases', headers=headers); \
13
- html = urllib.request.urlopen(req).read().decode('utf-8'); \
14
- links = re.findall(r'/UnderminersTeam/UndertaleModTool/releases/download/[^\"]+\.zip', html); \
15
- l_links = [l for l in links if 'linux' in l.lower() or 'ubuntu' in l.lower()]; \
16
- if not l_links: \
17
- req = urllib.request.Request('https://github.com/UnderminersTeam/UndertaleModTool/releases/expanded_assets/bleeding-edge', headers=headers); \
18
- html = urllib.request.urlopen(req).read().decode('utf-8'); \
19
- links = re.findall(r'/UnderminersTeam/UndertaleModTool/releases/download/[^\"]+\.zip', html); \
20
- l_links = [l for l in links if 'linux' in l.lower() or 'ubuntu' in l.lower()]; \
21
- url = 'https://github.com' + l_links[0]; \
22
- print('--------------------------------------'); \
23
- print('BULUNAN KESİN LİNK:', url); \
24
- print('--------------------------------------'); \
25
- urllib.request.urlretrieve(url, 'umt.zip')" && \
 
 
 
 
 
 
 
 
26
  unzip -q umt.zip -d umt && \
27
- rm umt.zip && \
28
  find umt -type f -iname "UndertaleModCli*" -exec chmod +x {} \;
29
 
30
  COPY . .
 
1
  FROM mcr.microsoft.com/dotnet/sdk:8.0
2
  WORKDIR /app
3
 
4
+ # Gerekli ağ araçlarını kuruyoruz
5
  RUN apt-get update && apt-get install -y python3 python3-pip wget unzip curl
6
 
7
  COPY requirements.txt .
8
  RUN pip3 install --no-cache-dir -r requirements.txt --break-system-packages
9
 
10
+ # API Limitlerine veya Bash sözdizimi hatalarına takılmamak için betiği bir DOSYAYA yazıyoruz.
11
+ # (\x22 kodu, tırnak işareti (") çakışmasını engellemek için kullanılan zekice bir hex hilesidir)
12
+ RUN echo 'import urllib.request, re, sys\n\
13
+ headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}\n\
14
+ urls_to_try = ["https://github.com/UnderminersTeam/UndertaleModTool/releases/expanded_assets/bleeding-edge", "https://github.com/UnderminersTeam/UndertaleModTool/releases"]\n\
15
+ for page_url in urls_to_try:\n\
16
+ try:\n\
17
+ req = urllib.request.Request(page_url, headers=headers)\n\
18
+ html = urllib.request.urlopen(req).read().decode("utf-8")\n\
19
+ links = re.findall(r"/UnderminersTeam/UndertaleModTool/releases/download/[^\x22]+\.zip", html)\n\
20
+ linux_links = [l for l in links if "linux" in l.lower() or "ubuntu" in l.lower()]\n\
21
+ if linux_links:\n\
22
+ print("https://github.com" + linux_links[0])\n\
23
+ sys.exit(0)\n\
24
+ except Exception:\n\
25
+ pass\n\
26
+ sys.exit(1)\n\
27
+ ' > get_url.py
28
+
29
+ # Oluşturduğumuz betiği çalıştır, linki kesin olarak al ve indir
30
+ RUN DOWNLOAD_URL=$(python3 get_url.py) && \
31
+ echo "=========================================" && \
32
+ echo "BULUNAN KESIN LINK: $DOWNLOAD_URL" && \
33
+ echo "=========================================" && \
34
+ wget -qO umt.zip "$DOWNLOAD_URL" && \
35
  unzip -q umt.zip -d umt && \
36
+ rm umt.zip get_url.py && \
37
  find umt -type f -iname "UndertaleModCli*" -exec chmod +x {} \;
38
 
39
  COPY . .