Skip to the content.

CI/CD Pipeline

Overview

This project uses GitHub Actions for continuous integration and deployment.

Workflow Trigger

The pipeline runs on every push to the main branch.

Pipeline Steps

1. Test Stage

2. Deploy Stage

Multi-Stage Dockerfile

Test Stage

FROM python:3.11-slim AS test
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY main.py test_main.py .
RUN pytest test_main.py -v

Production Stage

FROM python:3.11-slim AS production
WORKDIR /app
RUN pip install --no-cache-dir fastapi uvicorn[standard] pydantic
COPY main.py .
CMD ["python", "main.py"]

Security

Usage

Push to main branch and the pipeline automatically:

  1. ✅ Runs all tests
  2. 🚀 Deploys if tests pass
  3. ❌ Fails deployment if tests fail

Back to Home