Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim-bookworm | |
| WORKDIR /app | |
| # Install dependencies, PostgreSQL, and Supervisor | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| libpq-dev \ | |
| postgresql-15 \ | |
| postgresql-client-15 \ | |
| supervisor \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set up PostgreSQL directories and permissions | |
| RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql \ | |
| && mkdir -p /var/lib/postgresql/data && chown -R postgres:postgres /var/lib/postgresql/data | |
| USER root | |
| # Copy requirements and install python packages | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application files | |
| COPY . . | |
| # Copy and setup supervisor config | |
| COPY supervisord.conf /etc/supervisor/supervisord.conf | |
| # Setup start script | |
| COPY start.sh /start.sh | |
| RUN chmod +x /start.sh | |
| # Environment variables for default DB setup if not provided | |
| ENV DB_USER=admin | |
| ENV DB_PASSWORD=admin123 | |
| ENV DB_NAME=growth_panel_db | |
| ENV DATABASE_URL=postgresql+asyncpg://admin:admin123@localhost:5432/growth_panel_db | |
| EXPOSE 7860 | |
| EXPOSE 5432 | |
| CMD ["/start.sh"] | |