File size: 1,400 Bytes
6807ed8
 
 
 
 
 
4497eca
6807ed8
 
 
 
 
 
 
 
 
4497eca
6807ed8
 
4497eca
 
 
 
 
 
 
 
6807ed8
 
 
 
4497eca
6807ed8
4497eca
6807ed8
 
 
 
 
 
 
 
 
4497eca
6807ed8
4497eca
6807ed8
 
 
 
 
 
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
46
47
48
49
50
51
52
FROM python:3.11-slim-bookworm

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PGDATA=/data/postgres

# Install PostgreSQL 15 + tools
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        postgresql-15 \
        postgresql-contrib-15 \
        postgresql-client-15 \
        supervisor \
        curl \
        unzip \
        sudo \
        procps \
    && rm -rf /var/lib/apt/lists/*

# Install pgweb (lightweight PostgreSQL web UI)
RUN curl -sL https://github.com/sosedoff/pgweb/releases/download/v0.16.0/pgweb_linux_amd64.zip \
    -o /tmp/pgweb.zip && \
    unzip /tmp/pgweb.zip -d /usr/local/bin/ && \
    mv /usr/local/bin/pgweb_linux_amd64 /usr/local/bin/pgweb && \
    chmod +x /usr/local/bin/pgweb && \
    rm /tmp/pgweb.zip

# Install Python dependencies
COPY requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/requirements.txt

# Create directories
RUN mkdir -p /data/postgres \
             /data/backup \
             /var/run/postgresql \
             /var/log/supervisor \
             /app && \
    chown -R postgres:postgres /data/postgres /var/run/postgresql && \
    chmod 700 /data/postgres

# Copy application files
COPY start.sh /app/start.sh
COPY sync_manager.py /app/sync_manager.py
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

RUN chmod +x /app/start.sh

WORKDIR /app

EXPOSE 7860

CMD ["/app/start.sh"]