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
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
__pycache__
*.py[cod]
*.log
*.sqlite*
*.db
.env
.env.*
.git
.gitignore
playwright-log.txt
/tests
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.11-slim

# Install OS dependencies required by Playwright
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*

# Set work directory
WORKDIR /app

# Install Python dependencies first
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
playwright install --with-deps

# Copy application code
COPY . .

EXPOSE 8000

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
# vehicle-tracker
# Vehicle Tracker

This project provides a FastAPI service that scrapes vehicle listings from AutoTrader using Playwright and stores them in a database.

## Local Development

1. Install dependencies:
```bash
pip install -r requirements.txt
```
2. Start the server:
```bash
uvicorn app.main:app --reload
```

## Docker Usage

Build the Docker image using the included helper script:

```bash
./build.sh
```

Alternatively build manually:

```bash
docker build -t vehicle-tracker .
```

Run the container and expose port `8000`:

```bash
docker run --env-file .env -p 8000:8000 vehicle-tracker
```

The API will then be available at `http://localhost:8000`.
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e

docker build -t vehicle-tracker "$@" .

echo "Image built as vehicle-tracker. Run with:"
echo " docker run --env-file .env -p 8000:8000 vehicle-tracker"