Skip to content
Merged
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 .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Django settings
DJANGO_SECRET_KEY=your-secret-key
DJANGO_DEBUG=True
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1

# Custom port override (optional)
HOST_PORT=8004
PORT=8000

# Optional database settings (if using a remote DB)
# DATABASE_URL=postgresql://user:password@host:5432/dbname
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM python:3.11-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

# Set working directory
WORKDIR /app

# Install system dependencies for Prophet and others
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
gcc \
g++ \
curl \
libatlas-base-dev \
libblas-dev \
liblapack-dev \
libgfortran5 \
libffi-dev \
libpython3-dev \
python3-dev \
&& rm -rf /var/lib/apt/lists/*

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

# Copy the rest of the code
COPY . .

# Optional: run migrations here or in entrypoint
# RUN python forecast_system/manage.py migrate

# Copy and set permissions for entrypoint
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Set entrypoint
ENTRYPOINT ["/entrypoint.sh"]
14 changes: 14 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.9'

services:
forecasting-app:
build: .
container_name: forecasting_app
ports:
- "${HOST_PORT:-8000}:8000"
env_file:
- .env
volumes:
- .:/app
working_dir: /app/forecast_system
restart: unless-stopped
8 changes: 8 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

echo "📦 Running migrations..."
python manage.py migrate

PORT=${PORT:-8000}
echo "🚀 Starting Django server on port $PORT"
python manage.py runserver 0.0.0.0:$PORT