forked from tianon/docker-postgres-upgrade
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.template
42 lines (28 loc) · 1.3 KB
/
Dockerfile.template
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
FROM postgres:%%POSTGRES_NEW%%-%%SUITE%%
RUN sed -i 's/$/ %%POSTGRES_OLD%%/' /etc/apt/sources.list.d/pgdg.list
RUN apt-get update && apt-get install -y --no-install-recommends \
gnupg \
postgresql-%%POSTGRES_OLD%%=%%POSTGRES_OLD_VERSION%% \
postgresql-contrib-%%POSTGRES_OLD%%=%%POSTGRES_OLD_VERSION%% \
postgresql-common \
apt-transport-https \
lsb-release \
wget \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN yes "" | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
RUN echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" | tee /etc/apt/sources.list.d/timescaledb.list
RUN wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add -
RUN apt update
RUN apt install -y --no-install-recommends timescaledb-2-postgresql-%%POSTGRES_NEW%%
ENV PGBINOLD /usr/lib/postgresql/%%POSTGRES_OLD%%/bin
ENV PGBINNEW /usr/lib/postgresql/%%POSTGRES_NEW%%/bin
ENV PGDATAOLD /var/lib/postgresql/%%POSTGRES_OLD%%/data
ENV PGDATANEW /var/lib/postgresql/%%POSTGRES_NEW%%/data
RUN mkdir -p "$PGDATAOLD" "$PGDATANEW" \
&& chown -R postgres:postgres /var/lib/postgresql
WORKDIR /var/lib/postgresql
COPY docker-upgrade /usr/local/bin/
ENTRYPOINT ["docker-upgrade"]
# recommended: --link
CMD ["pg_upgrade"]