fix(postgres): scws 需先 ./acprep 生成 configure
This commit is contained in:
@@ -1,32 +1,38 @@
|
||||
FROM postgres:16-bookworm
|
||||
|
||||
# zhparser 中文分词扩展 — 全源码编译
|
||||
# Debian / PGDG 仓库里都没有现成的 postgresql-16-zhparser / libscws-dev 包,
|
||||
# 必须从 GitHub 拉源码自己 make
|
||||
# Debian / PGDG 仓库里都没有 postgresql-16-zhparser / libscws-dev / scws 包,
|
||||
# 必须从 GitHub 拉源码自己 make。
|
||||
#
|
||||
# 步骤:
|
||||
# 1) 装编译工具 + PG dev headers
|
||||
# 2) 编译装 scws(https://github.com/hightman/scws,zhparser 依赖的分词库)
|
||||
# 3) 编译装 zhparser(https://github.com/zhparser/zhparser)
|
||||
# 1) 装编译工具链 + PG dev headers
|
||||
# 2) 编译 scws(autotools 项目,先 ./acprep 生成 configure)
|
||||
# 3) 编译 zhparser(PGXS 扩展,直接 make)
|
||||
#
|
||||
# build 时间:~3-5 分钟
|
||||
# 产物:/usr/lib/postgresql/16/lib/zhparser.so + libscws.so
|
||||
# 产物:/usr/lib/postgresql/16/lib/zhparser.so + /usr/lib/libscws.so
|
||||
|
||||
RUN set -eux; \
|
||||
# 1) 编译工具链
|
||||
# 1) 编译工具 + PG dev headers
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
git \
|
||||
ca-certificates \
|
||||
# autotools(scws 依赖)
|
||||
autoconf \
|
||||
automake \
|
||||
libtool \
|
||||
# pg_config / pgxs(编译 PG 扩展用)
|
||||
postgresql-server-dev-16; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 2) 编译 scws(中文分词库)
|
||||
# 2) 编译装 scws(autotools:先 ./acprep 生成 configure,再 ./configure && make)
|
||||
RUN set -eux; \
|
||||
cd /tmp; \
|
||||
git clone --depth 1 https://github.com/hightman/scws.git; \
|
||||
cd scws; \
|
||||
./acprep; \
|
||||
./configure --prefix=/usr; \
|
||||
make -j$(nproc); \
|
||||
make install; \
|
||||
@@ -34,12 +40,11 @@ RUN set -eux; \
|
||||
cd /; \
|
||||
rm -rf /tmp/scws
|
||||
|
||||
# 3) 编译 zhparser
|
||||
# 3) 编译装 zhparser(PGXS 扩展,直接 make)
|
||||
RUN set -eux; \
|
||||
cd /tmp; \
|
||||
git clone --depth 1 https://github.com/zhparser/zhparser.git; \
|
||||
cd zhparser; \
|
||||
# PG_CONFIG 在 PATH 上(装 postgresql-server-dev-16 自带)
|
||||
make -j$(nproc); \
|
||||
make install; \
|
||||
cd /; \
|
||||
|
||||
Reference in New Issue
Block a user