Skip to content

Commit c332f80

Browse files
committed
Dockerize MiniDB for easy deployment and review
1 parent fd070c2 commit c332f80

4 files changed

Lines changed: 63 additions & 0 deletions

File tree

.dockerignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
__pycache__/
2+
*.py[cod]
3+
*$py.class
4+
.venv/
5+
env/
6+
venv/
7+
ENV/
8+
.git/
9+
.gitignore
10+
data/
11+
*.lock
12+
*.tmp
13+
*.log
14+
tests_final.txt

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Use a lightweight Python base image
2+
FROM python:3.10-slim
3+
4+
# Set the working directory in the container
5+
WORKDIR /app
6+
7+
# Install system dependencies if needed (none strictly required for MiniDB right now)
8+
# RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/*
9+
10+
# Copy requirements first to leverage Docker cache
11+
COPY requirements.txt .
12+
13+
# Install Python dependencies
14+
RUN pip install --no-cache-dir -r requirements.txt
15+
16+
# Copy the rest of the application code
17+
COPY . .
18+
19+
# Create the data directory
20+
RUN mkdir -p data
21+
22+
# Expose the port Flask runs on
23+
EXPOSE 5000
24+
25+
# Set environment variables
26+
ENV FLASK_APP=app.py
27+
ENV FLASK_RUN_HOST=0.0.0.0
28+
29+
# Command to run the application
30+
CMD ["python", "app.py"]

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ To support multiple users/processes, MiniDB implements a global `LockManager`:
9494
python main.py
9595
```
9696

97+
### 🐳 Run with Docker
98+
If you have Docker installed, you can spin up the entire system with a single command:
99+
```bash
100+
docker-compose up --build
101+
```
102+
- **Web UI**: Access at `http://localhost:5000`
103+
- **Persistence**: Database files are automatically mapped to the `./data` folder on your host machine.
104+
97105
## ⚠️ Known Limitations (Prototype Scope)
98106
- **SQL Breadth**: Supports a subset of SQL syntax. Complex multi-level aggregate functions (SUM, AVG) are not yet implemented.
99107
- **Memory Residency**: While storage is streaming, the primary key index is kept in-memory for $O(1)$ speed. Extremely large keyspace may require a B-Tree file-baked index.

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3.8'
2+
3+
services:
4+
minidb:
5+
build: .
6+
container_name: minidb_app
7+
ports:
8+
- "5000:5000"
9+
volumes:
10+
- ./data:/app/data
11+
restart: unless-stopped

0 commit comments

Comments
 (0)