feat: add demo app
This commit is contained in:
5
Dockerfile
Normal file
5
Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
FROM python:3.11-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY app.py .
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["python", "app.py"]
|
||||||
11
README.md
Normal file
11
README.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# demo-app
|
||||||
|
|
||||||
|
Minimal Python HTTP service used to validate the Gitea -> Tekton -> Harbor flow.
|
||||||
|
|
||||||
|
## Local Test
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t demo-app:local .
|
||||||
|
docker run --rm -p 8080:8080 demo-app:local
|
||||||
|
curl http://127.0.0.1:8080/
|
||||||
|
```
|
||||||
22
app.py
Normal file
22
app.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
class Handler(BaseHTTPRequestHandler):
|
||||||
|
def do_GET(self):
|
||||||
|
payload = {
|
||||||
|
"app": "demo-app",
|
||||||
|
"status": "ok",
|
||||||
|
"path": self.path,
|
||||||
|
}
|
||||||
|
body = json.dumps(payload).encode("utf-8")
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header("Content-Type", "application/json")
|
||||||
|
self.send_header("Content-Length", str(len(body)))
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(body)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
server = HTTPServer(("0.0.0.0", 8080), Handler)
|
||||||
|
server.serve_forever()
|
||||||
Reference in New Issue
Block a user