From 5ad674fb5f5ff80dd49d409b01724b7a73fe1bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=8D=8E?= <975412826@qq.com> Date: Tue, 1 Jul 2025 07:37:18 +0000 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B8=A6xdb=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李明华 <975412826@qq.com> --- Dockerfile-with-xdb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Dockerfile-with-xdb diff --git a/Dockerfile-with-xdb b/Dockerfile-with-xdb new file mode 100644 index 0000000..c6a9986 --- /dev/null +++ b/Dockerfile-with-xdb @@ -0,0 +1,33 @@ +FROM hub.gitee.com/library/golang:1.23-bullseye AS builder +WORKDIR /home/git/ip2region-grpc +COPY . . +RUN make + +FROM hub.gitee.com/library/debian:bullseye + +ENV USERNAME_UID=1000 +ENV USERNAME_GID=1000 +ENV USERNAME=git +ENV CATALINA_HOME=/home/${USERNAME} +ENV APPDIR=${CATALINA_HOME}/ip2region-grpc + +RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \ + && apt update \ + && apt install -y apt-transport-https ca-certificates \ + && apt update \ + && apt install -y wget dumb-init procps\ + && groupadd -g ${USERNAME_GID} ${USERNAME} \ + && useradd -d ${CATALINA_HOME} -s /bin/bash -u ${USERNAME_UID} -g ${USERNAME_GID} ${USERNAME} \ + && mkdir -p ${APPDIR}/bin \ + && mkdir -p ${APPDIR}/config \ + && mkdir -p /data/lfs/storage \ + && chown -R ${USERNAME_UID}:${USERNAME_GID} ${APPDIR} \ + && chown ${USERNAME_UID}:${USERNAME_GID} /data/lfs/storage \ + && rm -rf /var/lib/apt/lists/* +USER ${USERNAME} +WORKDIR ${APPDIR} +COPY --from=builder --chown=${USERNAME_UID}:${USERNAME_GID} --chmod=0755 /home/git/ip2region-grpc/ip2region-grpc ${APPDIR}/bin/ip2region-grpc +COPY --from=builder --chown=${USERNAME_UID}:${USERNAME_GID} --chmod=0755 /home/git/ip2region-grpc/high_full.xdb ${APPDIR}/high_full.xdb +COPY --chown=${USERNAME_UID}:${USERNAME_GID} --chmod=0755 entrypoint.sh /entrypoint.sh +EXPOSE 8001 +ENTRYPOINT ["/entrypoint.sh"] -- Gitee