Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

Commit 32917c9

Browse files
committed
Refactor Docker build script to remove platform specification and streamline build process; update log handling classes for improved clarity and functionality
1 parent 4cfbab7 commit 32917c9

2 files changed

Lines changed: 4 additions & 18 deletions

File tree

docker_build_push.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ for /f "tokens=2 delims==" %%I in ('"wmic os get localdatetime /value | findstr
66

77
set VERSION=%datetime:~0,4%.%datetime:~4,2%.%datetime:~6,2%.%datetime:~8,2%.%datetime:~10,2%
88

9-
docker buildx build --platform linux/amd64,linux/arm64 -t jarebear/hbni-audio-stream-recorder:%VERSION% -t jarebear/hbni-audio-stream-recorder:latest --push .
9+
docker buildx build -t jarebear/hbni-audio-stream-recorder:%VERSION% -t jarebear/hbni-audio-stream-recorder:latest --push .
1010

1111
echo Multi-architecture Docker image build and push complete.

main.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,8 @@ def send_notification(self):
400400
f"http://{os.getenv('LOG_SERVER_HOST')}:{os.getenv('PORT')}",
401401
)
402402

403-
404-
405-
class IndexHandler(RequestHandler):
406-
def get(self, filename):
403+
class LogFileHandler(RequestHandler):
404+
def get(self, filename: str):
407405
if filename == "logs":
408406
try:
409407
files = [f for f in natsorted(os.listdir("logs")) if f.endswith(".log")]
@@ -431,23 +429,11 @@ def get(self, filename):
431429
self.set_status(404)
432430
self.write("File not found.")
433431
app_log.error(f"File not found: {filename}")
434-
class LogFileHandler(RequestHandler):
435-
def get(self, filename):
436-
safe_filename = os.path.basename(filename)
437-
file_path = os.path.join("logs", safe_filename)
438-
if os.path.exists(file_path) and file_path.endswith(".log"):
439-
self.set_header("Content-Type", "text/plain; charset=utf-8")
440-
with open(file_path, "r", encoding="utf-8") as f:
441-
self.write(f.read())
442-
else:
443-
self.set_status(404)
444-
self.write("File not found.")
445-
app_log.error(f"File not found: {file_path}")
446432

447433

448434
def make_app():
449435
return Application([
450-
(r"/(.*)", IndexHandler),
436+
(r"/(.*)", LogFileHandler),
451437
(r"/logs/(.*)", LogFileHandler),
452438
])
453439

0 commit comments

Comments
 (0)