Skip to content

Commit aae391f

Browse files
Merge pull request #44 from Satvik-Singh192/feat/dockerize
feat: dockerized the whole project
2 parents 9559824 + 4436a8e commit aae391f

File tree

4 files changed

+136
-2
lines changed

4 files changed

+136
-2
lines changed

.dockerignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
venv/
2+
myenv/
3+
env/
4+
.venv/
5+
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
.vscode/
26+
.idea/
27+
*.swp
28+
*.swo
29+
*~
30+
.DS_Store
31+
.sublime-*
32+
33+
.git/
34+
.gitignore
35+
.gitattributes
36+
37+
.env
38+
.env.local
39+
40+
.coverage
41+
htmlcov/
42+
.pytest_cache/
43+
44+
*.db
45+
*.sqlite
46+
*.sqlite3
47+
.DS_Store
48+
Thumbs.db
49+
*.log
50+
.mypy_cache/
51+
.dmypy.json
52+
dmypy.json
53+
.pyre/

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM python:3.10-slim
2+
WORKDIR /app
3+
4+
COPY app/requirements.txt .
5+
RUN pip install --no-cache-dir -r requirements.txt
6+
7+
COPY . .
8+
CMD ["python", "-m", "app.main"]

README.md

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,74 @@ Contributors should search for these comments and fix the issues.
4545

4646
## 🛠 Setup Instructions
4747

48+
### Local Setup
49+
4850
Clone the repo and install dependencies:
4951

5052
```bash
5153
git clone https://github.com/<your-username>/etl-problems.git
5254
cd etl-problems
53-
pip install -r requirements.txt
54-
python main.py
55+
pip install -r app/requirements.txt
56+
python -m app.main
57+
```
58+
59+
### Running with Docker
60+
61+
Containerize the ETL pipeline for a consistent, isolated development environment across all machines.
62+
63+
**Prerequisites:** Docker and Docker Compose must be installed on your system.
64+
65+
**Quick Start:**
66+
67+
1. Clone the repository:
68+
```bash
69+
git clone https://github.com/<your-username>/etl-problems.git
70+
cd etl-problems
71+
```
72+
73+
2. Run the pipeline in a container:
74+
```bash
75+
docker-compose up
76+
```
77+
78+
This command will:
79+
- Build the Docker image from the provided `Dockerfile`
80+
- Start the ETL pipeline in an isolated container
81+
- Mount your local code directory as a volume, so changes you make to the code are immediately reflected in the container
82+
83+
**Rebuilding the Image:**
84+
85+
If you update dependencies in `requirements.txt`, rebuild the image:
86+
```bash
87+
docker-compose up --build
88+
```
89+
90+
**Interactive Mode:**
91+
92+
To run commands interactively inside the container:
93+
```bash
94+
docker-compose run etl bash
5595
```
5696

97+
Then inside the container, you can run:
98+
```bash
99+
python -m app.main
100+
python -m pytest tests/
101+
```
102+
103+
**Stopping the Container:**
104+
105+
```bash
106+
docker-compose down
107+
```
108+
109+
**Benefits:**
110+
- 🎯 **Consistency**: Same environment for all developers (Python 3.10, all dependencies)
111+
- 📦 **Isolation**: No conflicts with local Python installations
112+
- 🚀 **Reproducibility**: Works the same on Windows, macOS, and Linux
113+
- 🔧 **Hot Reload**: Code changes are immediately reflected without rebuilding
114+
- 🧪 **Testing**: Run tests in an isolated environment
115+
57116
---
58117

59118
## 🧪 Testing

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3.8'
2+
3+
services:
4+
etl:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
container_name: etl-pipeline
9+
volumes:
10+
- .:/app
11+
environment:
12+
- PYTHONUNBUFFERED=1
13+
working_dir: /app
14+
command: python -m app.main

0 commit comments

Comments
 (0)