-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (49 loc) · 1.57 KB
/
Dockerfile
File metadata and controls
59 lines (49 loc) · 1.57 KB
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
53
54
55
56
57
58
59
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies
RUN apt-get update && apt-get install -y \
postgresql-14 \
postgresql-client-14 \
etcd-server \
etcd-client \
curl \
jq \
python3 \
python3-pip \
supervisor \
sudo \
wget \
gnupg \
ca-certificates \
net-tools \
procps \
openssl \
xxd \
vim-common \
gnutls-bin \
&& rm -rf /var/lib/apt/lists/*
# Install Python packages
RUN pip3 install patroni[etcd] psycopg2-binary cryptography
# Create necessary directories
RUN mkdir -p /etc/patroni /app /var/log/supervisor /var/lib/postgresql/data /etc/ssl/cluster/{ca,etcd,postgres,patroni}
# Create postgres user and set permissions
RUN chown -R postgres:postgres /var/lib/postgresql
RUN chmod 700 /var/lib/postgresql/data
# Copy configuration templates and scripts
COPY entrypoint.sh /app/entrypoint.sh
COPY patroni.yml.tpl /app/patroni.yml.tpl
COPY update-cluster.sh /app/update-cluster.sh
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY start-etcd.sh /app/start-etcd.sh
COPY post_bootstrap.sh /app/post_bootstrap.sh
COPY diagnose.sh /app/diagnose.sh
COPY generate-certs.sh /app/generate-certs.sh
COPY VERSION /app/VERSION
# Make scripts executable
RUN chmod +x /app/entrypoint.sh /app/update-cluster.sh /app/diagnose.sh /app/generate-certs.sh /app/start-etcd.sh /app/post_bootstrap.sh
# Set working directory
WORKDIR /app
# Expose ports
EXPOSE 5432 8008 2379 2380
# Run entrypoint script then start supervisord
CMD ["/bin/bash", "-c", "/app/entrypoint.sh && supervisord -n"]