Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
.gitignore
.venv39
venv
__pycache__
*.pyc
*.pyo
*.pyd
db.sqlite3
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Use official lightweight Python 3.11 image
FROM python:3.11-slim

# Prevent Python from writing .pyc files and enable unbuffered logging
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

WORKDIR /app

# Install system dependencies required for building wheels (mysqlclient, Pillow)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
default-libmysqlclient-dev \
pkg-config \
libjpeg-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements and install
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the backend code
COPY . /app/

EXPOSE 8000

# Run the development server
CMD ["python", "website/manage.py", "runserver", "0.0.0.0:8000"]
41 changes: 41 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3.8'

services:
backend:
build:
context: .
dockerfile: Dockerfile
container_name: recursion-backend
ports:
- "8000:8000"
volumes:
# Mount the website folder to preserve the db.sqlite3 and allow hot-reloading
- ./website:/app/website
env_file:
- ./website/.env
environment:
# Override the host-specific database path to the container path
- DATABASE_URL=sqlite:////app/website/db.sqlite3
- FRONTEND_BASE_URL=http://localhost:3000
restart: always

frontend:
build:
context: ../RECursionNITD-Frontend
dockerfile: Dockerfile
container_name: recursion-frontend
ports:
- "3000:3000"
volumes:
- ../RECursionNITD-Frontend/src:/app/src
- ../RECursionNITD-Frontend/public:/app/public
env_file:
- ../RECursionNITD-Frontend/.env
environment:
- REACT_APP_BACKEND_URL=http://localhost:8000
# Required for Create React App to stay alive in Docker
stdin_open: true
tty: true
restart: always
depends_on:
- backend