# 腾讯云 CVM 专用加速构建:把 apt 源换成国内镜像(debian→腾讯云内网、pgdg→阿里云),
|
# 其余与仓库根 docker/postgres/Dockerfile 完全一致。
|
# 仅用于在腾讯云 CVM 上构建 cx/postgres:18.4;原 Dockerfile 保持官方源(交付其他客户现场用)。
|
#
|
# 换源点:
|
# /etc/apt/sources.list.d/debian.sources deb.debian.org → mirrors.tencentyun.com(内网直连)
|
# /etc/apt/sources.list.d/pgdg.list apt.postgresql.org/pub/repos/apt → mirrors.aliyun.com/postgresql/repos/apt
|
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/postgres:18.4 AS pg_bigm_builder
|
|
RUN sed -i 's|deb.debian.org|mirrors.tencentyun.com|g' /etc/apt/sources.list.d/debian.sources \
|
&& sed -i 's|apt.postgresql.org/pub/repos/apt|mirrors.aliyun.com/postgresql/repos/apt|g' /etc/apt/sources.list.d/pgdg.list \
|
&& apt-get update \
|
&& apt-get install -y --no-install-recommends \
|
build-essential \
|
postgresql-server-dev-18 \
|
libicu-dev \
|
git \
|
ca-certificates \
|
&& git clone --depth 1 --branch v1.2-20250903 \
|
https://github.com/pgbigm/pg_bigm.git /tmp/pg_bigm \
|
&& make -C /tmp/pg_bigm USE_PGXS=1 PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config \
|
&& make -C /tmp/pg_bigm USE_PGXS=1 PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config install
|
|
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/postgres:18.4
|
|
RUN sed -i 's|deb.debian.org|mirrors.tencentyun.com|g' /etc/apt/sources.list.d/debian.sources \
|
&& sed -i 's|apt.postgresql.org/pub/repos/apt|mirrors.aliyun.com/postgresql/repos/apt|g' /etc/apt/sources.list.d/pgdg.list \
|
&& apt-get update \
|
&& apt-get install -y --no-install-recommends \
|
postgresql-18-pgvector \
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY --from=pg_bigm_builder /usr/lib/postgresql/18/lib/pg_bigm.so /usr/lib/postgresql/18/lib/
|
COPY --from=pg_bigm_builder /usr/share/postgresql/18/extension/pg_bigm* /usr/share/postgresql/18/extension/
|