|
1 |
| -FROM postgres:13 AS extension_builder |
| 1 | +ARG postgres_version=13 |
| 2 | + |
| 3 | +# extension builder |
| 4 | +FROM postgres:${postgres_version} AS extension_builder |
2 | 5 |
|
3 |
| -# Already download extension code |
4 | 6 | RUN cd / && mkdir external_extensions && mkdir /external_extensions/sequential-uuids
|
5 | 7 | COPY lib/sequential-uuids/ /external_extensions/sequential-uuids/
|
6 | 8 | WORKDIR /external_extensions/sequential-uuids/
|
7 | 9 |
|
8 |
| -# additional: change sources.list, but postgres source is still slow. don't need if proxy is used. |
9 |
| -# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" > /etc/apt/sources.list |
10 |
| -# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free" >> /etc/apt/sources.list |
11 |
| -# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list |
12 |
| -# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list |
13 |
| - |
14 |
| - |
15 | 10 | RUN apt-get update && apt install build-essential libicu-dev postgresql-server-dev-all -y --no-install-recommends
|
16 | 11 | RUN make clean && make install
|
17 | 12 |
|
18 |
| -FROM postgres:13 |
| 13 | +# main image |
| 14 | +FROM postgres:${postgres_version} |
| 15 | + |
| 16 | +ARG pg_version_in_path=13 |
19 | 17 |
|
20 | 18 | LABEL maintainer= "[email protected]"
|
21 | 19 |
|
22 | 20 | # run find / -name 'sequential_uuids*' to find newly compiled files and copy to next stage
|
23 |
| -COPY --from=extension_builder /usr/lib/postgresql/13/lib /usr/lib/postgresql/13/lib |
24 |
| -COPY --from=extension_builder /usr/share/postgresql/13/extension /usr/share/postgresql/13/extension |
| 21 | +COPY --from=extension_builder /usr/lib/postgresql/${pg_version_in_path}/lib /usr/lib/postgresql/${pg_version_in_path}/lib |
| 22 | +COPY --from=extension_builder /usr/share/postgresql/${pg_version_in_path}/extension /usr/share/postgresql/${pg_version_in_path}/extension |
25 | 23 |
|
26 | 24 | # ref: https://github.com/docker-library/postgres/issues/340
|
27 | 25 |
|
28 | 26 | # after in sql:
|
29 | 27 | # CREATE EXTENSION sequential_uuids;
|
30 |
| - |
31 |
| - |
0 commit comments