File tree Expand file tree Collapse file tree 5 files changed +28
-12
lines changed Expand file tree Collapse file tree 5 files changed +28
-12
lines changed Original file line number Diff line number Diff line change 23
23
python -m pip install --upgrade pip
24
24
pip install flask pytest
25
25
26
+ - name : Debug: List Files
27
+ run : ls -R # Helps debug missing files issue
28
+
26
29
- name : Run tests
27
- run : pytest
30
+ run : pytest -v --tb=short # Verbose mode for better debugging
28
31
29
32
build-and-publish :
30
33
needs : build-and-test
51
54
tags : ${{ secrets.DOCKER_USERNAME }}/flasktest-app:latest
52
55
53
56
- 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 }}"
Original file line number Diff line number Diff line change
1
+ # Use slim Python image
1
2
FROM python:3.9-slim
2
3
4
+ # Set working directory
3
5
WORKDIR /app
4
6
7
+ # Copy application files
5
8
COPY . /app
6
9
7
- RUN pip install flask
10
+ # Install dependencies
11
+ RUN pip install flask pytest
8
12
13
+ # Expose port 5000 for Flask
9
14
EXPOSE 5000
10
15
16
+ # Start Flask app
11
17
CMD ["python", "app.py"]
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 1
1
from flask import Flask
2
2
3
-
4
- app = Flask (__name__ )
3
+ app = Flask (__name__ )
5
4
6
5
@app .route ("/" )
7
6
def home ():
8
- return "hello world "
7
+ return "Hello, World! " # Fix to match test case
9
8
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
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments