Skip to content

Commit c85fbc8

Browse files
Merge pull request #2 from ahsan-javed-ds/feat/mlops-pipeline-addition
Feat/mlops pipeline addition
2 parents 49dc284 + 91d81c9 commit c85fbc8

19 files changed

+451
-238
lines changed

.github/workflows/test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI Pipeline
2+
3+
# Trigger on push or pull request to the main branch or your feature branch
4+
on:
5+
push:
6+
branches: [ "main", "feat/mlops-pipeline-addition" ]
7+
pull_request:
8+
branches: [ "main" ]
9+
10+
jobs:
11+
build-and-test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
# 1. Check out the repository code
16+
- name: Checkout Code
17+
uses: actions/checkout@v3
18+
19+
# 2. Set up Python environment
20+
- name: Set up Python 3.9
21+
uses: actions/setup-python@v3
22+
with:
23+
python-version: "3.9"
24+
25+
# 3. Install dependencies
26+
- name: Install Dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -r requirements.txt
30+
pip install pytest flake8
31+
32+
# 4. Lint with Flake8
33+
- name: Lint with Flake8
34+
run: |
35+
# stop the build if there are Python syntax errors or undefined names
36+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37+
38+
# 5. Test Application Startup (Syntax Check)
39+
- name: Check FastAPI Syntax
40+
run: |
41+
# This compiles the python file to check for syntax errors without running the server
42+
python -m compileall fastapi_app.py

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Using a lightweight Python base image
2+
FROM python:3.9-slim
3+
4+
# Setting 'Working Directory' inside the container
5+
WORKDIR /app
6+
7+
# Installing System Dependencies
8+
RUN apt-get update && apt-get install -y \
9+
libgomp1 \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
# Copy dependency list first (for better caching)
13+
COPY requirements.txt .
14+
15+
# Install dependencies
16+
RUN pip install --no-cache-dir -r requirements.txt
17+
18+
# Copy the Application Code and Model Files
19+
COPY fastapi_app.py .
20+
COPY *.joblib .
21+
22+
# Expose the port FastAPI will be running
23+
EXPOSE 8000
24+
25+
# Command To run the application
26+
CMD ["uvicorn", "fastapi_app:app", "--host", "0.0.0.0", "--port", "8000"]

0 commit comments

Comments
 (0)