This commit is contained in:
2026-03-07 03:01:43 +00:00
commit 365cb6692e
8 changed files with 240 additions and 0 deletions

26
app.py Normal file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""Minimal web app for deployment example."""
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
PORT = int(os.environ.get("PORT", 8080))
VERSION = os.environ.get("VERSION", "dev")
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(
f"<h1>Hello from Docker!</h1><p>Version: {VERSION}</p>".encode()
)
def log_message(self, format, *args):
print(f"[{self.log_date_time_string()}] {format % args}")
if __name__ == "__main__":
server = HTTPServer(("", PORT), Handler)
print(f"Server running on port {PORT}")
server.serve_forever()