Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup & add ARG #2

Merged
merged 1 commit into from
Oct 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions 12/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
FROM postgres:12 AS extension_builder
ARG postgres_version=12

# extension builder
FROM postgres:${postgres_version} AS extension_builder

# Already download extension code
RUN cd / && mkdir external_extensions && mkdir /external_extensions/sequential-uuids
COPY lib/sequential-uuids/ /external_extensions/sequential-uuids/
WORKDIR /external_extensions/sequential-uuids/

# additional: change sources.list, but postgres source is still slow. don't need if proxy is used.
# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" > /etc/apt/sources.list
# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free" >> /etc/apt/sources.list
# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list
# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list


RUN apt-get update && apt install build-essential libicu-dev postgresql-server-dev-all -y --no-install-recommends
RUN make clean && make install

FROM postgres:12
# main image
FROM postgres:${postgres_version}

ARG pg_version_in_path=12

LABEL maintainer="[email protected]"

# run find / -name 'sequential_uuids*' to find newly compiled files and copy to next stage
COPY --from=extension_builder /usr/lib/postgresql/12/lib /usr/lib/postgresql/12/lib
COPY --from=extension_builder /usr/share/postgresql/12/extension /usr/share/postgresql/12/extension
COPY --from=extension_builder /usr/lib/postgresql/${pg_version_in_path}/lib /usr/lib/postgresql/${pg_version_in_path}/lib
COPY --from=extension_builder /usr/share/postgresql/${pg_version_in_path}/extension /usr/share/postgresql/${pg_version_in_path}/extension

# ref: https://github.com/docker-library/postgres/issues/340

24 changes: 10 additions & 14 deletions 13/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
FROM postgres:13 AS extension_builder
ARG postgres_version=13

# extension builder
FROM postgres:${postgres_version} AS extension_builder

# Already download extension code
RUN cd / && mkdir external_extensions && mkdir /external_extensions/sequential-uuids
COPY lib/sequential-uuids/ /external_extensions/sequential-uuids/
WORKDIR /external_extensions/sequential-uuids/

# additional: change sources.list, but postgres source is still slow. don't need if proxy is used.
# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" > /etc/apt/sources.list
# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free" >> /etc/apt/sources.list
# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list
# RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list


RUN apt-get update && apt install build-essential libicu-dev postgresql-server-dev-all -y --no-install-recommends
RUN make clean && make install

FROM postgres:13
# main image
FROM postgres:${postgres_version}

ARG pg_version_in_path=13

LABEL maintainer="[email protected]"

# run find / -name 'sequential_uuids*' to find newly compiled files and copy to next stage
COPY --from=extension_builder /usr/lib/postgresql/13/lib /usr/lib/postgresql/13/lib
COPY --from=extension_builder /usr/share/postgresql/13/extension /usr/share/postgresql/13/extension
COPY --from=extension_builder /usr/lib/postgresql/${pg_version_in_path}/lib /usr/lib/postgresql/${pg_version_in_path}/lib
COPY --from=extension_builder /usr/share/postgresql/${pg_version_in_path}/extension /usr/share/postgresql/${pg_version_in_path}/extension

# ref: https://github.com/docker-library/postgres/issues/340

# after in sql:
# CREATE EXTENSION sequential_uuids;