Skip to content

Commit

Permalink
Use ENV again
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Nov 4, 2024
1 parent 8f1d5af commit b23459d
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
ARG POSTGRES_VERSION=17
FROM postgres:${POSTGRES_VERSION}

FROM postgres:$POSTGRES_VERSION
ENV POSTGRES_VERSION=${POSTGRES_VERSION}

RUN apt-get update
RUN apt-mark hold locales
RUN apt-get install curl ca-certificates -y
RUN install -d /usr/share/postgresql-common/pgdg
RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Install prerequisites and configure PostgreSQL for wal2json
RUN apt-get update && apt-mark hold locales && \
apt-get install -y curl ca-certificates && \
install -d /usr/share/postgresql-common/pgdg && \
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc && \
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

RUN echo "Setting up PostgreSQL $POSTGRES_VERSION with wal2json"
RUN apt-get update
RUN apt-get install postgresql-server-dev-$POSTGRES_VERSION -y
RUN sh -c 'export PATH=/usr/lib/postgresql/$POSTGRES_VERSION/bin:$PATH'
RUN apt-get install postgresql-$POSTGRES_VERSION-wal2json -y
RUN echo "Setting up PostgreSQL ${POSTGRES_VERSION} with wal2json" && \
apt-get update && \
apt-get install -y postgresql-server-dev-${POSTGRES_VERSION} && \
export PATH=/usr/lib/postgresql/${POSTGRES_VERSION}/bin:$PATH && \
apt-get install -y postgresql-${POSTGRES_VERSION}-wal2json

0 comments on commit b23459d

Please sign in to comment.