Auto-generated by Trail System

This commit is contained in:
Ivan087
2025-11-28 11:04:20 +08:00
commit c4580fc437
6 changed files with 77 additions and 0 deletions

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
# Build stage
FROM python:3.9-slim as build
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Runtime stage
FROM python:3.9-slim
WORKDIR /app
COPY --from=build /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
COPY . .
RUN pip install --no-cache-dir gunicorn
EXPOSE 5000
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]

16
app.py Normal file
View File

@ -0,0 +1,16 @@
from flask import Flask
app = Flask(__name__)
@app.route('/')
def todo_list():
"""Route to return the Todo List page."""
return 'Todo List'
@app.errorhandler(404)
def page_not_found(e):
"""Handle 404 errors."""
return 'Page not found', 404
if __name__ == '__main__':
app.run(debug=False)

6
chart/Chart.yaml Normal file
View File

@ -0,0 +1,6 @@
apiVersion: v2
name: todo-app
description: A minimal Todo App built with Python Flask, containerized with Docker, and prepared for Kubernetes deployment via Helm. The application serves a simple 'Todo List' message at the root endpoint.
type: application
version: 0.1.0
appVersion: "1.0.0"

View File

@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: todo-app
spec:
replicas: 1
selector:
matchLabels:
app: todo-app
template:
metadata:
labels:
app: todo-app
spec:
containers:
- name: todo-app
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
ports:
- containerPort: 5000
env:
- name: FLASK_APP
value: "app.py"
- name: FLASK_DEBUG
value: "false"

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: todo-app-service
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
selector:
app: todo-app

6
chart/values.yaml Normal file
View File

@ -0,0 +1,6 @@
image:
repository: todo-app
tag: latest
service:
port: 5000
type: ClusterIP