Spaces:
Paused
Paused
| FROM ubuntu:22.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV PGDATA=/data/pgdata | |
| ENV POSTGRES_DB=xroagent | |
| ENV POSTGRES_USER=xroagent | |
| ENV POSTGRES_PASSWORD=1720409166 | |
| RUN apt-get update && apt-get install -y \ | |
| postgresql \ | |
| postgresql-contrib \ | |
| supervisor \ | |
| curl \ | |
| python3 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create data directory (HF persistent storage mounts here) | |
| RUN mkdir -p /data/pgdata && chown -R postgres:postgres /data | |
| # Init PostgreSQL | |
| USER postgres | |
| RUN /usr/lib/postgresql/14/bin/initdb -D /data/pgdata | |
| # Allow all connections (HF internal network) | |
| RUN echo "host all all 0.0.0.0/0 md5" >> /data/pgdata/pg_hba.conf && \ | |
| echo "listen_addresses='*'" >> /data/pgdata/postgresql.conf | |
| # Start postgres, create user + db | |
| RUN /usr/lib/postgresql/14/bin/pg_ctl -D /data/pgdata start && \ | |
| sleep 3 && \ | |
| psql -c "CREATE USER xroagent WITH SUPERUSER PASSWORD '1720409166';" && \ | |
| psql -c "CREATE DATABASE xroagent OWNER xroagent;" && \ | |
| /usr/lib/postgresql/14/bin/pg_ctl -D /data/pgdata stop | |
| USER root | |
| COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
| COPY healthcheck.sh /healthcheck.sh | |
| RUN chmod +x /healthcheck.sh | |
| # HF Spaces uses port 7860 for HTTP — we expose a simple health API here | |
| # PostgreSQL runs internally on 5432 | |
| EXPOSE 7860 | |
| CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"] |