Skip to content

ENHANCEMENT: Add Docker and docker-compose support for development and deployment #28

Description

@Senthil455

Description

There is no Docker configuration for the project. Setting up a development environment requires manually installing Python, PostgreSQL, and configuring dependencies. A Docker setup would streamline onboarding and provide consistent environments across development, testing, and production.

Recommended Enhancement

  1. Create a Dockerfile:

    FROM python:3.12-slim
    
    WORKDIR /app
    
    COPY requirements.txt .
    RUN pip install --no-cache-dir -r requirements.txt
    
    COPY . .
    
    EXPOSE 5000
    
    CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]
  2. Create a docker-compose.yml for local development:

    version: '3.8'
    
    services:
      db:
        image: postgres:16-alpine
        environment:
          POSTGRES_DB: edutrack
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        ports:
          - "5432:5432"
        volumes:
          - pgdata:/var/lib/postgresql/data
          - ./schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
          - ./seed_data.sql:/docker-entrypoint-initdb.d/02-seed.sql
    
      web:
        build: .
        ports:
          - "5000:5000"
        environment:
          DATABASE_URL: postgresql://postgres:postgres@db:5432/edutrack
          SECRET_KEY: ${SECRET_KEY:-change-me-in-production}
          TEACHER_SUPERKEY: ${TEACHER_SUPERKEY:-change-me-in-production}
        depends_on:
          - db
    
    volumes:
      pgdata:
  3. Add a .dockerignore file:

    .venv/
    __pycache__/
    *.pyc
    .env
    .git/
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions