Skip to content

Commit ae8d05d

Browse files
committed
3rd
2 parents 159cfaf + c234883 commit ae8d05d

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

.github/workflows/cicd.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ jobs:
2323
python -m pip install --upgrade pip
2424
pip install flask pytest
2525
26+
- name: Debug: List Files
27+
run: ls -R # Helps debug missing files issue
28+
2629
- name: Run tests
27-
run: pytest
30+
run: pytest -v --tb=short # Verbose mode for better debugging
2831

2932
build-and-publish:
3033
needs: build-and-test
@@ -51,6 +54,4 @@ jobs:
5154
tags: ${{ secrets.DOCKER_USERNAME }}/flasktest-app:latest
5255

5356
- name: Image digest
54-
run: echo ${{ steps.docker_build.outputs.digest }}
55-
56-
## modified
57+
run: echo "Docker Image Digest: ${{ steps.docker_build.outputs.digest }}"

DockerFile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
# Use slim Python image
12
FROM python:3.9-slim
23

4+
# Set working directory
35
WORKDIR /app
46

7+
# Copy application files
58
COPY . /app
69

7-
RUN pip install flask
10+
# Install dependencies
11+
RUN pip install flask pytest
812

13+
# Expose port 5000 for Flask
914
EXPOSE 5000
1015

16+
# Start Flask app
1117
CMD ["python", "app.py"]

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
## Create an End-to-End MLops project with GitHub action workflow and DockerHub integration.
1+
<<<<<<< HEAD
2+
## Create an End-to-End MLops project with GitHub action workflow and DockerHub integration.
3+
=======
4+
## Create an End-to-End MLops project with GitHub action workflow and DockerHub integration.
5+
>>>>>>> c234883201868eb611a71cc098f9a947d9c6771c

app.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from flask import Flask
22

3-
4-
app= Flask(__name__)
3+
app = Flask(__name__)
54

65
@app.route("/")
76
def home():
8-
return "hello world"
7+
return "Hello, World!" # Fix to match test case
98

10-
if __name__=="__main__":
11-
app.run(debug=True)
12-
9+
if __name__ == "__main__":
10+
app.run(debug=True, host="0.0.0.0", port=5000) # Ensure it's accessible in Docker

test_app.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from app import app
2+
3+
def test_home():
4+
client = app.test_client()
5+
response = client.get('/')
6+
assert response.status_code == 200
7+
assert response.data == b"Hello, World!" # Match Flask response

0 commit comments

Comments
 (0)