20251101
This commit is contained in:
parent
68edea1f7b
commit
023e4b2565
153
auto/images.yaml
153
auto/images.yaml
@ -373,34 +373,81 @@ images:
|
|||||||
# platforms:
|
# platforms:
|
||||||
# - "linux/amd64"
|
# - "linux/amd64"
|
||||||
# - "linux/arm64"
|
# - "linux/arm64"
|
||||||
|
- name: "alpine"
|
||||||
|
from: "alpine"
|
||||||
|
tags:
|
||||||
|
- tag: "3.22"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
- tag: "3.21"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
- tag: "3.20"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
- tag: "3.19"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
- tag: "3.18"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
|
||||||
#- name: "golang"
|
- name: "golang"
|
||||||
# from: "golang"
|
from: "golang"
|
||||||
# tags:
|
tags:
|
||||||
# - tag: "1.24"
|
- tag: "1.24-alpine3.21"
|
||||||
# platforms:
|
platforms:
|
||||||
# - "linux/amd64"
|
- "linux/amd64"
|
||||||
# - "linux/arm64"
|
- "linux/arm64"
|
||||||
# - tag: "1.23"
|
- tag: "1.23-alpine3.21"
|
||||||
# platforms:
|
platforms:
|
||||||
# - "linux/amd64"
|
- "linux/amd64"
|
||||||
# - "linux/arm64"
|
- "linux/arm64"
|
||||||
# - tag: "1.22"
|
- tag: "1.22-alpine3.21"
|
||||||
# platforms:
|
platforms:
|
||||||
# - "linux/amd64"
|
- "linux/amd64"
|
||||||
# - "linux/arm64"
|
- "linux/arm64"
|
||||||
# - tag: "1.21"
|
- tag: "1.21-alpine3.21"
|
||||||
# platforms:
|
platforms:
|
||||||
# - "linux/amd64"
|
- "linux/amd64"
|
||||||
# - "linux/arm64"
|
- "linux/arm64"
|
||||||
# - tag: "1.20"
|
- tag: "1.20-alpine3.21"
|
||||||
# platforms:
|
platforms:
|
||||||
# - "linux/amd64"
|
- "linux/amd64"
|
||||||
# - "linux/arm64"
|
- "linux/arm64"
|
||||||
# - tag: "1.19"
|
- tag: "1.19-alpine3.21"
|
||||||
# platforms:
|
platforms:
|
||||||
# - "linux/amd64"
|
- "linux/amd64"
|
||||||
# - "linux/arm64"
|
- "linux/arm64"
|
||||||
|
- tag: "1.24"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
- tag: "1.23"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
- tag: "1.22"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
- tag: "1.21"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
- tag: "1.20"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
- tag: "1.19"
|
||||||
|
platforms:
|
||||||
|
- "linux/amd64"
|
||||||
|
- "linux/arm64"
|
||||||
|
|
||||||
# - name: "python"
|
# - name: "python"
|
||||||
# from: "python"
|
# from: "python"
|
||||||
@ -602,32 +649,32 @@ images:
|
|||||||
# - "linux/amd64"
|
# - "linux/amd64"
|
||||||
# - "linux/arm64"
|
# - "linux/arm64"
|
||||||
|
|
||||||
- name: "mysql"
|
# - name: "mysql"
|
||||||
tags:
|
# tags:
|
||||||
- tag: "9.3"
|
# - tag: "9.3"
|
||||||
platforms:
|
# platforms:
|
||||||
- "linux/amd64"
|
# - "linux/amd64"
|
||||||
- "linux/arm64"
|
# - "linux/arm64"
|
||||||
- tag: "9.0"
|
# - tag: "9.0"
|
||||||
platforms:
|
# platforms:
|
||||||
- "linux/amd64"
|
# - "linux/amd64"
|
||||||
- "linux/arm64"
|
# - "linux/arm64"
|
||||||
- tag: "9"
|
# - tag: "9"
|
||||||
platforms:
|
# platforms:
|
||||||
- "linux/amd64"
|
# - "linux/amd64"
|
||||||
- "linux/arm64"
|
# - "linux/arm64"
|
||||||
- tag: "8.4"
|
# - tag: "8.4"
|
||||||
platforms:
|
# platforms:
|
||||||
- "linux/amd64"
|
# - "linux/amd64"
|
||||||
- "linux/arm64"
|
# - "linux/arm64"
|
||||||
- tag: "8.0"
|
# - tag: "8.0"
|
||||||
platforms:
|
# platforms:
|
||||||
- "linux/amd64"
|
# - "linux/amd64"
|
||||||
- "linux/arm64"
|
# - "linux/arm64"
|
||||||
- tag: "8"
|
# - tag: "8"
|
||||||
platforms:
|
# platforms:
|
||||||
- "linux/amd64"
|
# - "linux/amd64"
|
||||||
- "linux/arm64"
|
# - "linux/arm64"
|
||||||
|
|
||||||
# - name: "pgadmin4"
|
# - name: "pgadmin4"
|
||||||
# from: "dpage/pgadmin4"
|
# from: "dpage/pgadmin4"
|
||||||
|
|||||||
BIN
manual/postgis/3.5.3.tar.gz
Normal file
BIN
manual/postgis/3.5.3.tar.gz
Normal file
Binary file not shown.
87
manual/postgis/Dockerfile.template
Normal file
87
manual/postgis/Dockerfile.template
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
# 基础镜像
|
||||||
|
FROM quay.io/wandoubaba517/postgres:{$VERSION}
|
||||||
|
|
||||||
|
# 切换为root用户执行安装操作
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# 先安装wget(解决wget: not found问题)
|
||||||
|
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 配置国内源并采用现代方式管理GPG密钥
|
||||||
|
RUN echo "deb http://mirrors.aliyun.com/debian/ bookworm main non-free contrib" > /etc/apt/sources.list && \
|
||||||
|
echo "deb-src http://mirrors.aliyun.com/debian/ bookworm main non-free contrib" >> /etc/apt/sources.list && \
|
||||||
|
echo "deb http://mirrors.aliyun.com/debian-security/ bookworm-security main" >> /etc/apt/sources.list && \
|
||||||
|
echo "deb-src http://mirrors.aliyun.com/debian-security/ bookworm-security main" >> /etc/apt/sources.list && \
|
||||||
|
echo "deb http://mirrors.aliyun.com/debian/ bookworm-updates main non-free contrib" >> /etc/apt/sources.list && \
|
||||||
|
echo "deb-src http://mirrors.aliyun.com/debian/ bookworm-updates main non-free contrib" >> /etc/apt/sources.list && \
|
||||||
|
rm -rf /etc/apt/sources.list.d/* && \
|
||||||
|
# 添加PostgreSQL国内镜像
|
||||||
|
echo "deb http://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/apt/ bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
|
||||||
|
# 现代方式:将GPG密钥保存到trusted.gpg.d(替代apt-key add)
|
||||||
|
mkdir -p /etc/apt/trusted.gpg.d && \
|
||||||
|
wget --no-check-certificate -O /etc/apt/trusted.gpg.d/postgresql.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc && \
|
||||||
|
chmod 644 /etc/apt/trusted.gpg.d/postgresql.asc
|
||||||
|
|
||||||
|
# 安装编译工具和依赖库
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
tar \
|
||||||
|
gzip \
|
||||||
|
postgresql-server-dev-{$VERSION} \
|
||||||
|
libprotobuf-c-dev \
|
||||||
|
protobuf-c-compiler \
|
||||||
|
libgeos-dev \
|
||||||
|
libproj-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
libjson-c-dev \
|
||||||
|
gdal-bin \
|
||||||
|
libgdal-dev \
|
||||||
|
libpcre3-dev \
|
||||||
|
libsfcgal-dev \
|
||||||
|
libgtk2.0-dev \
|
||||||
|
libcunit1-dev \
|
||||||
|
xsltproc \
|
||||||
|
libtool \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 下载并解压PostGIS 3.5.3源码(GitHub官方标签)
|
||||||
|
COPY 3.5.3.tar.gz /
|
||||||
|
RUN tar -xvzf 3.5.3.tar.gz \
|
||||||
|
&& mv postgis-3.5.3 postgis-src
|
||||||
|
|
||||||
|
# 配置编译选项(基于postgres:和GitHub源码)
|
||||||
|
RUN cd postgis-src \
|
||||||
|
&& ./autogen.sh \
|
||||||
|
&& ./configure \
|
||||||
|
--with-pgconfig=/usr/lib/postgresql/{$VERSION}/bin/pg_config \
|
||||||
|
--with-geosconfig=/usr/bin/geos-config \
|
||||||
|
--with-projdir=/usr \
|
||||||
|
--with-gdalconfig=/usr/bin/gdal-config \
|
||||||
|
--with-xml2config=/usr/bin/xml2-config \
|
||||||
|
--with-jsondir=/usr \
|
||||||
|
--with-pcredir=/usr \
|
||||||
|
--with-sfcgal=/usr/bin/sfcgal-config \
|
||||||
|
--with-raster \
|
||||||
|
--with-topology \
|
||||||
|
--without-phony-revision
|
||||||
|
|
||||||
|
# 编译并安装PostGIS 3.5.3
|
||||||
|
RUN cd postgis-src \
|
||||||
|
&& make -j$(nproc) \
|
||||||
|
&& make install \
|
||||||
|
&& make comments-install
|
||||||
|
|
||||||
|
# 创建PostGIS初始化脚本
|
||||||
|
RUN echo "CREATE EXTENSION IF NOT EXISTS postgis;" > /docker-entrypoint-initdb.d/init-postgis.sql \
|
||||||
|
&& echo "CREATE EXTENSION IF NOT EXISTS postgis_raster;" >> /docker-entrypoint-initdb.d/init-postgis.sql \
|
||||||
|
&& echo "CREATE EXTENSION IF NOT EXISTS postgis_topology;" >> /docker-entrypoint-initdb.d/init-postgis.sql \
|
||||||
|
&& chmod 644 /docker-entrypoint-initdb.d/init-postgis.sql
|
||||||
|
|
||||||
|
# 清理编译残留(关键:不卸载tar,避免依赖冲突)
|
||||||
|
RUN rm -rf 3.5.3.tar.gz postgis-src \
|
||||||
|
&& apt-get purge -y build-essential wget \
|
||||||
|
&& apt-get autoremove -y \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 切换回postgres用户
|
||||||
|
USER postgres
|
||||||
35
manual/postgis/README.md
Normal file
35
manual/postgis/README.md
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# 基于postgres构建postgis
|
||||||
|
|
||||||
|
## postgis源码
|
||||||
|
|
||||||
|
```url
|
||||||
|
https://github.com/postgis/postgis/archive/refs/tags/3.5.3.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
## 构建命令
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# 检查 buildx 是否可用
|
||||||
|
docker buildx version
|
||||||
|
# 创建名为 "multiplatform-builder" 的构建器
|
||||||
|
docker buildx create --name multiplatform-builder --use
|
||||||
|
|
||||||
|
# 启动构建器(若需要)
|
||||||
|
docker buildx inspect --bootstrap
|
||||||
|
|
||||||
|
# 构建并自动推送到仓库(需已登录)
|
||||||
|
docker buildx build \
|
||||||
|
--platform linux/amd64,linux/arm64 \
|
||||||
|
--tag quay.io/wandoubaba517/postgis:16-3.5 \
|
||||||
|
--push \
|
||||||
|
.
|
||||||
|
```
|
||||||
|
|
||||||
|
**关键参数说明**
|
||||||
|
|
||||||
|
**--platform linux/amd64,linux/arm64**:指定构建两个平台的镜像(分别对应 x86_64 和 ARM64 架构)。
|
||||||
|
|
||||||
|
**--tag**:指定镜像的完整路径(包含 quay.io 仓库、用户名、镜像名和标签)。
|
||||||
|
|
||||||
|
**--push**:构建完成后自动推送到 quay.io 仓库(无需手动执行 docker push)。
|
||||||
|
|
||||||
38
manual/postgis/build.sh
Executable file
38
manual/postgis/build.sh
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 定义日志文件
|
||||||
|
LOG_FILE="buildx.log"
|
||||||
|
|
||||||
|
# 确保版本文件最后有换行符
|
||||||
|
if [ -n "$(tail -c 1 versions)" ]; then
|
||||||
|
echo "" >> versions
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 读取版本文件并遍历每一行
|
||||||
|
while IFS= read -r VERSION; do
|
||||||
|
# 跳过空行
|
||||||
|
[ -z "$VERSION" ] && continue
|
||||||
|
|
||||||
|
# 获取当前日期时间
|
||||||
|
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
|
# 记录开始构建的日志
|
||||||
|
echo "[$TIMESTAMP] 开始构建并上传 quay.io/wandoubaba517/postgis:${VERSION}-3.5 镜像" >> "$LOG_FILE"
|
||||||
|
|
||||||
|
# 替换模板中的版本号并生成 Dockerfile
|
||||||
|
sed "s/{\$VERSION}/$VERSION/g" Dockerfile.template > "Dockerfile_${VERSION}"
|
||||||
|
|
||||||
|
# 执行构建命令
|
||||||
|
if docker buildx build --platform linux/amd64,linux/arm64 --push -t "quay.io/wandoubaba517/postgis:${VERSION}-3.5" -f "Dockerfile_${VERSION}" .; then
|
||||||
|
STATUS="success"
|
||||||
|
else
|
||||||
|
STATUS="failed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 删除生成的 Dockerfile
|
||||||
|
rm "Dockerfile_${VERSION}"
|
||||||
|
|
||||||
|
# 记录完成构建的日志
|
||||||
|
echo "[$TIMESTAMP] 完成构建并上传 quay.io/wandoubaba517/postgis:${VERSION}-3.5 镜像 $STATUS" >> "$LOG_FILE"
|
||||||
|
|
||||||
|
done < versions
|
||||||
5
manual/postgis/versions
Normal file
5
manual/postgis/versions
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
17
|
||||||
|
16
|
||||||
|
15
|
||||||
|
14
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user