initial commit

master
Nihonium 3 weeks ago
commit fc0b9a1268
Signed by: nihonium
GPG Key ID: 0251623741027CFC

@ -0,0 +1,9 @@
FROM python:3.11-slim
WORKDIR /server
COPY src/server.py .
EXPOSE 8888
CMD ["python", "server.py"]

@ -0,0 +1,23 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/healthz':
self.send_response(200)
self.send_header('Content-type', 'text/plain')
self.end_headers()
self.wfile.write(b'200 OK\n')
else:
self.send_response(404)
self.send_header('Content-type', 'text/plain')
self.end_headers()
self.wfile.write(b'Not Found\n')
def run(server_class=HTTPServer, handler_class=RequestHandler, port=8888):
server_address = ('', port)
httpd = server_class(server_address, handler_class)
print(f'Starting http server on port {port}')
httpd.serve_forever()
if __name__ == "__main__":
run()
Loading…
Cancel
Save