chore: add sample docker
Browse files- Dockerfile +5 -0
- server.py +18 -0
Dockerfile
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.12-slim-bookworm
|
2 |
+
WORKDIR /app
|
3 |
+
COPY . /app
|
4 |
+
EXPOSE 7860
|
5 |
+
CMD ["python", "server.py"]
|
server.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from http.server import SimpleHTTPRequestHandler, HTTPServer
|
2 |
+
|
3 |
+
class HelloWorldHandler(SimpleHTTPRequestHandler):
|
4 |
+
def do_GET(self):
|
5 |
+
self.send_response(200)
|
6 |
+
self.send_header("Content-type", "text/html")
|
7 |
+
self.end_headers()
|
8 |
+
self.wfile.write(b"<html><head><title>Hello Spaces</title></head>")
|
9 |
+
self.wfile.write(b"<body><h1>Hello Spaces</h1></body></html>")
|
10 |
+
|
11 |
+
def run(server_class=HTTPServer, handler_class=HelloWorldHandler):
|
12 |
+
server_address = ('', 7860)
|
13 |
+
httpd = server_class(server_address, handler_class)
|
14 |
+
print("Starting httpd server on port 7860...")
|
15 |
+
httpd.serve_forever()
|
16 |
+
|
17 |
+
if __name__ == "__main__":
|
18 |
+
run()
|