Add basic server image
This commit is contained in:
parent
0e8691c765
commit
7e5b1007a3
4
basic_server/Dockerfile
Normal file
4
basic_server/Dockerfile
Normal file
@ -0,0 +1,4 @@
|
||||
FROM python:3-slim
|
||||
COPY server.py /server.py
|
||||
EXPOSE 80
|
||||
CMD ["python3", "/server.py"]
|
2
basic_server/build.sh
Executable file
2
basic_server/build.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
sudo docker build -t pierre42100/gns3-appliance-basic-server .
|
17
basic_server/server.py
Normal file
17
basic_server/server.py
Normal file
@ -0,0 +1,17 @@
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
|
||||
PORT = 80
|
||||
|
||||
print(f"Will listen on port {PORT}")
|
||||
|
||||
class handler(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type','text/html')
|
||||
self.end_headers()
|
||||
|
||||
message = "Hello, World! Here is simple HTTP response..."
|
||||
self.wfile.write(bytes(message, "utf8"))
|
||||
|
||||
with HTTPServer(('', PORT), handler) as server:
|
||||
server.serve_forever()
|
Loading…
Reference in New Issue
Block a user