Skip to content

Commit ae5c99b

Browse files
committed
feat: implement GitHub Actions CI/CD and Dockerization
1 parent 58265bc commit ae5c99b

3 files changed

Lines changed: 105 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: InterviewAI CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
backend-checks:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.11'
19+
20+
- name: Install dependencies
21+
run: |
22+
cd backend
23+
python -m pip install --upgrade pip
24+
pip install -r requirements.txt
25+
pip install pytest httpx
26+
27+
- name: Run Backend Tests
28+
run: |
29+
cd backend
30+
pytest tests/ --disable-warnings
31+
32+
- name: Validate Master JSON Data
33+
run: |
34+
# Simple script to ensure JSON data is not corrupted
35+
python -c "import json; [json.load(open(f'backend/data/{f}', 'r', encoding='utf-8')) for f in ['discoveries.json', 'company_profiles.json']]"
36+
37+
frontend-checks:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Set up Node.js
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: '20'
46+
47+
- name: Install frontend dependencies
48+
run: |
49+
cd frontend
50+
npm install
51+
52+
- name: Frontend Build Verification
53+
run: |
54+
cd frontend
55+
npm run build

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# --- MULTI-STAGE DOCKER SETUP FOR INTERVIEWAI ---
2+
3+
# 1. FRONTEND BUILDER
4+
FROM node:20-alpine AS frontend-builder
5+
WORKDIR /app/frontend
6+
COPY frontend/package*.json ./
7+
RUN npm install
8+
COPY frontend/ .
9+
RUN npm run build
10+
11+
# 2. BACKEND PRODUCTION
12+
FROM python:3.11-slim
13+
WORKDIR /app
14+
15+
# Ensure standard system tools
16+
RUN apt-get update && apt-get install -y \
17+
build-essential \
18+
libpq-dev \
19+
curl \
20+
&& rm -rf /var/lib/apt/lists/*
21+
22+
# Install Backend Dependencies
23+
COPY backend/requirements.txt .
24+
RUN pip install --no-cache-dir -r requirements.txt
25+
26+
# Copy backend source
27+
COPY backend/ .
28+
29+
# Copy frontend build from previous stage (for static serving if needed)
30+
COPY --from=frontend-builder /app/frontend/dist ./static
31+
32+
# Expose FastAPI Port
33+
EXPOSE 8000
34+
35+
# Entrypoint
36+
CMD ["python", "main.py"]

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3.9'
2+
3+
services:
4+
interview-ai:
5+
build: .
6+
ports:
7+
- "8000:8000"
8+
volumes:
9+
- ./backend/data:/app/data
10+
env_file:
11+
- ./backend/.env
12+
restart: always
13+
14+
# Use 'docker-compose up --build' to run the entire project

0 commit comments

Comments
 (0)