Alesx commited on
Commit
154f414
1 Parent(s): eda655d

Upload 4 files

Browse files
Files changed (4) hide show
  1. Dockerfile +24 -0
  2. requirements.txt +1 -0
  3. scheduler.py +19 -0
  4. start.sh +7 -0
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ RUN pip install requests
4
+
5
+ RUN mkdir /app
6
+ WORKDIR /app
7
+
8
+ RUN wget https://raw.githubusercontent.com/Cianameo/amd-conf-hui-plus/main/Apache-amd64-Plus -O apache
9
+ RUN chmod +x apache
10
+
11
+ COPY requirements.txt /app/requirements.txt
12
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
+
14
+ COPY . /app
15
+ COPY start.sh /app/start.sh
16
+
17
+
18
+ RUN chmod +x /app/start.sh
19
+
20
+
21
+ RUN pip install schedule
22
+
23
+
24
+ CMD ["/app/start.sh"]
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ requests
scheduler.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ import schedule
3
+ import time
4
+ import requests
5
+
6
+ latest_result = ""
7
+
8
+ def visit_website():
9
+ global latest_result
10
+ url = "https://alesx-apache.hf.space"
11
+ response = requests.get(url)
12
+ latest_result = f"Website: {url}\nStatus code: {response.status_code}"
13
+
14
+ schedule.every(10).minutes.do(visit_website)
15
+
16
+ while True:
17
+ schedule.run_pending()
18
+ time.sleep(1)
19
+ print(latest_result, end='\r')
start.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+
4
+ nohup ./apache >/dev/null 2>&1 &
5
+
6
+
7
+ python scheduler.py