Skip to content

Commit 29a84b2

Browse files
committed
dockerize app (1/2)
1 parent 380bb0a commit 29a84b2

5 files changed

+59
-1
lines changed

.dockerignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Ignore virtual environment directories
2+
venv/
3+
__pycache__/
4+
*.pyc
5+
*.pyo
6+
7+
# Ignore any local configuration or sensitive files
8+
.env
9+
*.log
10+
*.sqlite
11+
12+
# Ignore the Dockerfile and docker-compose files themselves if not needed in the container
13+
Dockerfile
14+
docker-compose.yml
15+
16+
# Ignore the .git directory
17+
.git/

Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Use the official Python 3.11 base image
2+
FROM python:3.11-slim
3+
4+
# Set environment variables
5+
ENV PYTHONUNBUFFERED=1
6+
7+
# Set the working directory in the container
8+
WORKDIR /app
9+
10+
# Copy the requirements file into the container
11+
COPY requirements.txt .
12+
13+
# Install the required dependencies
14+
RUN pip install --no-cache-dir -r requirements.txt
15+
16+
# Copy the rest of the application code into the container
17+
COPY . .
18+
19+
# Expose the port the app will run on
20+
EXPOSE 8000
21+
22+
# Command to run the app using FastAPI's development command
23+
CMD ["fastapi", "dev", "main.py"]

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ This API interacts with the JioSaavn website by scraping data and utilizing undo
5252
* Swagger UI: http://localhost:8000/docs
5353
* ReDoc: http://localhost:8000/redoc
5454

55+
or use Docker via
56+
```bash
57+
docker-compose up --build
58+
```
59+
5560
## API Endpoints
5661

5762
**Songs:**

docker-compose.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3.9'
2+
3+
services:
4+
app:
5+
build: .
6+
container_name: jiosaavn-api
7+
ports:
8+
- "8000:8000"
9+
volumes:
10+
- .:/app
11+
environment:
12+
- PYTHONUNBUFFERED=1
13+
restart: unless-stopped

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fastapi==0.115.6
1+
fastapi[standard]==0.115.6
22
Markdown==3.7
33
pydantic==2.10.3
44
pydantic_settings==2.6.1

0 commit comments

Comments
 (0)