Initial commit
This commit is contained in:
12
nginx-python/.dockerignore
Normal file
12
nginx-python/.dockerignore
Normal file
@ -0,0 +1,12 @@
|
||||
#.dockerignore
|
||||
# Docker
|
||||
.dockerignore
|
||||
dockerfile
|
||||
compose.yaml
|
||||
compose.yml
|
||||
|
||||
# Git
|
||||
.gitignore
|
||||
*.md
|
||||
example.env
|
||||
|
||||
1
nginx-python/README.md
Normal file
1
nginx-python/README.md
Normal file
@ -0,0 +1 @@
|
||||
todo README.md
|
||||
6
nginx-python/compose.yml
Normal file
6
nginx-python/compose.yml
Normal file
@ -0,0 +1,6 @@
|
||||
services:
|
||||
meow:
|
||||
image: image:latest
|
||||
container_name: somename4test
|
||||
restart: unless-stopped
|
||||
|
||||
8
nginx-python/dockerfile
Normal file
8
nginx-python/dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM python:3.13-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD ["python", "src/main.py"]
|
||||
|
||||
32
nginx-python/src/main.py
Normal file
32
nginx-python/src/main.py
Normal file
@ -0,0 +1,32 @@
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
|
||||
|
||||
class MyHandler(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', 'text/html')
|
||||
self.end_headers()
|
||||
html_content = """
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Meow</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>I'm cat so meow</h1>
|
||||
<p>The current time is: {}</p>
|
||||
</body>
|
||||
</html>
|
||||
""".format(self.date_time_string())
|
||||
self.wfile.write(html_content.encode('utf-8'))
|
||||
|
||||
|
||||
def run(server_class=HTTPServer, handler_class=MyHandler, port=4422):
|
||||
server_address = ('', port)
|
||||
httpd = server_class(server_address, handler_class)
|
||||
print(f'Starting httpd server on port {port}...')
|
||||
httpd.serve_forever()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
Reference in New Issue
Block a user