Skip to content

Commit 8b47478

Browse files
committed
dockerised backend, created dockerfile for dev and prod envirnments.
1 parent e787a62 commit 8b47478

File tree

15 files changed

+91
-387
lines changed

15 files changed

+91
-387
lines changed

.dockerignore

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,22 @@ SMTP_PASSWORD=your_app_specific_password
1919
SMTP_FROM_EMAIL=your_email@gmail.com
2020
SMTP_FROM_NAME=KCET College Predictor
2121

22-
# Google OAuth (for Google-specific validation, optional since Supabase handles OAuth)
22+
# Google OAuth
2323
GOOGLE_CLIENT_ID=
2424
GOOGLE_CLIENT_SECRET=
2525
GEMINI_API_KEY=your-gemini-api-key
2626

27-
# Supabase Configuration
28-
# Get these from: https://supabase.com/dashboard/project/YOUR_PROJECT/settings/api
29-
SUPABASE_URL=https://your-project-id.supabase.co
30-
SUPABASE_KEY=your-anon-public-key
31-
SUPABASE_SERVICE_KEY=your-service-role-key
27+
# PostgreSQL Configuration
28+
POSTGRES_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/collegefinder
3229

3330
# JWT Configuration
3431
JWT_SECRET_KEY=generate-a-random-secret-key-at-least-32-chars
3532
JWT_ALGORITHM=HS256
3633
JWT_EXPIRATION_HOURS=24
3734

38-
DEBUG=true
35+
DEBUG=true
36+
37+
# AWS / ECR Deployment
38+
AWS_REGION=ap-south-1
39+
ECR_REPO=<account-id>.dkr.ecr.<region>.amazonaws.com/<repo-name>
40+
IMAGE_TAG=latest

API_DOCUMENTATION.md

Lines changed: 0 additions & 169 deletions
This file was deleted.

Makefile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
-include .env
2+
export
3+
4+
COMPOSE = docker compose -f infra/docker-compose.yml
5+
6+
.PHONY: backend frontend up down db migrate logs clean deploy-ecr
7+
8+
# Start backend + postgres (docker)
9+
up:
10+
$(COMPOSE) up --build
11+
12+
# Start only backend + postgres
13+
backend:
14+
$(COMPOSE) up --build postgres backend
15+
16+
# Start frontend locally with npm
17+
frontend:
18+
cd app/frontend && npm run dev
19+
20+
# Start postgres only
21+
db:
22+
$(COMPOSE) up -d postgres
23+
24+
# Run alembic migrations (requires postgres running)
25+
migrate:
26+
cd app/backend && alembic upgrade head
27+
28+
# View logs
29+
logs:
30+
$(COMPOSE) logs -f
31+
32+
# Stop all services
33+
down:
34+
$(COMPOSE) down
35+
36+
# Stop all services and remove volumes (fresh start)
37+
clean:
38+
$(COMPOSE) down -v
39+
40+
# Deploy backend image to AWS ECR (requires .env with AWS_REGION, ECR_REPO, IMAGE_TAG)
41+
deploy-ecr:
42+
aws ecr get-login-password --region $(AWS_REGION) | docker login --username AWS --password-stdin $(ECR_REPO)
43+
docker build -f app/backend/Dockerfile -t $(ECR_REPO):$(IMAGE_TAG) app/backend
44+
docker push $(ECR_REPO):$(IMAGE_TAG)

SCHEMA.md

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM python:3.11-slim
22

33
WORKDIR /app
44

5-
# Install system dependencies if any
65
RUN apt-get update && apt-get install -y \
76
build-essential \
87
&& rm -rf /var/lib/apt/lists/*
@@ -12,8 +11,6 @@ RUN pip install --no-cache-dir -r requirements.txt
1211

1312
COPY . .
1413

15-
# Expose the port FastAPI runs on
1614
EXPOSE 8005
1715

18-
# Command to run the application locally with hot reload
1916
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8005", "--reload"]

0 commit comments

Comments
 (0)