diff --git a/.github/workflows/build-ci-image-proxysql.yml b/.github/workflows/build-ci-image-proxysql.yml new file mode 100644 index 0000000..b3c337f --- /dev/null +++ b/.github/workflows/build-ci-image-proxysql.yml @@ -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 }} diff --git a/oci/proxysql/Dockerfile b/oci/proxysql/Dockerfile new file mode 100644 index 0000000..74a2364 --- /dev/null +++ b/oci/proxysql/Dockerfile @@ -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"]