ci: add ProxySQL build workflow and Dockerfile

This commit is contained in:
Haitao Pan 2025-08-26 15:06:07 +08:00
parent e28c335bdb
commit fac7864956
2 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,29 @@
name: build image proxysql
on:
pull_request:
branches:
- main
paths:
- 'oci/proxysql/Dockerfile'
- '.github/workflows/build-ci-image-proxysql.yml'
workflow_dispatch:
branches:
- main
env:
IMAGE_REPO: "artifact.svc.plus"
jobs:
proxysql:
name: Build ProxySQL image
uses: svc-design/actions/.github/workflows/build-images.yaml@main
with:
method: 'docker'
registry_addr: "ghcr.io" # 推送到 GitHub Container Registry
dockerfile_path: 'oci/proxysql' # 你放 Dockerfile 的目录
image_name: 'public/base/proxysql' # 镜像仓库路径 (可按你实际改)
image_tag: '3.0.2-nojemalloc' # 标签,可以改成 latest 或 matrix
secrets:
artifactory_sa: ${{ secrets.REPO_USER }}
artifactory_pw: ${{ secrets.HELM_REPO_PASSWORD }}

44
oci/proxysql/Dockerfile Normal file
View File

@ -0,0 +1,44 @@
# ---- build stage ----
FROM ubuntu:22.04 AS build
ENV DEBIAN_FRONTEND=noninteractive
# 构建依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential gawk git ca-certificates pkg-config \
autoconf automake libtool cmake \
libssl-dev zlib1g-dev libaio-dev default-libmysqlclient-dev \
libgnutls28-dev libcurl4-openssl-dev \
bison flex libncurses5-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
# 完整 clone保留 tag不要 --depth=1
RUN git clone --branch v3.0.2 https://github.com/sysown/proxysql.git proxysql
WORKDIR /src/proxysql
# --- 禁用 jemalloc ---
RUN sed -ri 's/^(.*\bjemalloc\b.*:.*)$/\1\n\t@echo "skip building jemalloc"/' deps/Makefile || true \
&& sed -ri 's@-I\.\./deps/jemalloc/jemalloc/include/jemalloc@@g' src/Makefile lib/Makefile || true \
&& sed -ri 's/\s-ljemalloc(\s|$)/ /g' src/Makefile lib/Makefile || true
# 构建安装
RUN make cleanall || true \
&& make -j"$(nproc)" \
&& make install
# ---- runtime stage ----
FROM ubuntu:22.04
# 避免 jemalloc 被加载
ENV LD_PRELOAD=""
# 只拷贝二进制和配置文件
COPY --from=build /usr/local/bin/proxysql /usr/bin/proxysql
COPY --from=build /usr/local/etc/proxysql.cnf /etc/proxysql.cnf
EXPOSE 6032 6033 6080
ENTRYPOINT ["/usr/bin/proxysql", "-f", "-c", "/etc/proxysql.cnf"]