Skip to content

Commit 7a8ac4d

Browse files
authored
Ensure pg_rewind is included in path (#254)
1 parent 0e58cbc commit 7a8ac4d

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

pg16/Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ COPY ./bin/* /fly/bin/
2121

2222
FROM ubuntu:24.04
2323

24-
ENV PGDATA=/data/postgresql
25-
ENV PGPASSFILE=/data/.pgpass
26-
ENV AWS_SHARED_CREDENTIALS_FILE=/data/.aws/credentials
2724
ARG VERSION
2825
ARG PG_MAJOR_VERSION
2926
ARG POSTGIS_MAJOR=3
3027
ARG HAPROXY_VERSION=2.8
3128
ARG REPMGR_VERSION=5.4.1-1build2
3229

30+
ENV PGDATA=/data/postgresql
31+
ENV PGPASSFILE=/data/.pgpass
32+
ENV AWS_SHARED_CREDENTIALS_FILE=/data/.aws/credentials
33+
ENV PG_MAJOR_VERSION=${PG_MAJOR_VERSION}
34+
ENV PATH="/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin:$PATH"
35+
36+
3337
LABEL fly.app_role=postgres_cluster
3438
LABEL fly.version=${VERSION}
3539
LABEL fly.pg-version=${PG_VERSION}
@@ -63,16 +67,15 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
6367
haproxy=$HAPROXY_VERSION.\* \
6468
&& apt autoremove -y && apt clean
6569

66-
67-
# Add PostgreSQL bin directory to PATH
68-
ENV PATH="/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin:$PATH"
69-
7070
# Copy Go binaries from the builder stage
7171
COPY --from=builder /fly/bin/* /usr/local/bin
7272

7373
# Copy Postgres exporter
7474
COPY --from=wrouesnel/postgres_exporter:latest /postgres_exporter /usr/local/bin/
7575

76+
# Move pg_rewind into path.
77+
RUN ln -s /usr/lib/postgresql/${PG_MAJOR_VERSION}/bin/pg_rewind /usr/bin/pg_rewind
78+
7679
ADD /config/* /fly/
7780
RUN mkdir -p /run/haproxy/
7881
RUN usermod -d /data postgres

pg16/Dockerfile-timescaledb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ COPY ./bin/* /fly/bin/
2121

2222
FROM ubuntu:24.04
2323

24-
ENV PGDATA=/data/postgresql
25-
ENV PGPASSFILE=/data/.pgpass
26-
ENV AWS_SHARED_CREDENTIALS_FILE=/data/.aws/credentials
2724
ARG VERSION
2825
ARG PG_MAJOR_VERSION
2926
ARG POSTGIS_MAJOR=3
3027
ARG HAPROXY_VERSION=2.8
3128
ARG REPMGR_VERSION=5.4.1-1build2
3229

30+
ENV PGDATA=/data/postgresql
31+
ENV PGPASSFILE=/data/.pgpass
32+
ENV AWS_SHARED_CREDENTIALS_FILE=/data/.aws/credentials
33+
ENV PG_MAJOR_VERSION=${PG_MAJOR_VERSION}
34+
ENV PATH="/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin:$PATH"
35+
3336
LABEL fly.app_role=postgres_cluster
3437
LABEL fly.version=${VERSION}
3538
LABEL fly.pg-version=${PG_VERSION}
@@ -69,16 +72,15 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
6972
haproxy=$HAPROXY_VERSION.\* \
7073
&& apt autoremove -y && apt clean
7174

72-
73-
# Add PostgreSQL bin directory to PATH
74-
ENV PATH="/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin:$PATH"
75-
7675
# Copy Go binaries from the builder stage
7776
COPY --from=builder /fly/bin/* /usr/local/bin
7877

7978
# Copy Postgres exporter
8079
COPY --from=wrouesnel/postgres_exporter:latest /postgres_exporter /usr/local/bin/
8180

81+
# Move pg_rewind into path.
82+
RUN ln -s /usr/lib/postgresql/${PG_MAJOR_VERSION}/bin/pg_rewind /usr/bin/pg_rewind
83+
8284
ADD /config/* /fly/
8385
RUN mkdir -p /run/haproxy/
8486
RUN usermod -d /data postgres

0 commit comments

Comments
 (0)