Skip to content

Commit aa9f060

Browse files
committed
Initial commit: frontend, backend, Dockerfiles
0 parents  commit aa9f060

6 files changed

Lines changed: 46 additions & 0 deletions

File tree

README.md

Whitespace-only changes.

backend/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM python:3.10-slim
2+
3+
WORKDIR /app
4+
5+
COPY requirements.txt .
6+
RUN pip install --no-cache-dir -r requirements.txt
7+
8+
COPY . .
9+
10+
CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"]

backend/app.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from flask import Flask, jsonify
2+
3+
app = Flask(__name__)
4+
5+
@app.route("/ping")
6+
def ping():
7+
return jsonify({"message": "Backend API is alive!"})
8+
9+
if __name__ == "__main__":
10+
app.run(host="0.0.0.0", port=5000)

backend/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
flask
2+
gunicorn

frontend/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM nginx:latest
2+
COPY index.html /usr/share/nginx/html/index.html

frontend/index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>DevOps E2E Project</title>
5+
</head>
6+
7+
<body>
8+
<h2>Welcome to the DevOps End-to-End Pipeline Demo</h2>
9+
10+
<button onclick="callAPI()">Ping Backend</button>
11+
12+
<p id="result"></p>
13+
14+
<script>
15+
async function callAPI() {
16+
const res = await fetch("/api/ping");
17+
const data = await res.json();
18+
document.getElementById("result").innerText = data.message;
19+
}
20+
</script>
21+
</body>
22+
</html>

0 commit comments

Comments
 (0)