Spaces:
Paused
Paused
File size: 1,381 Bytes
bf9474d 9c55759 bf9474d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 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"] |