From ffd5cd28816e2466006cf51e6412e8e54def6efd Mon Sep 17 00:00:00 2001 From: wizardchen Date: Thu, 13 Nov 2025 20:01:04 +0800 Subject: [PATCH] feat: Update Dockerfile to support customizable APK mirror - Added APK_MIRROR_ARG to allow dynamic configuration of the Alpine package mirror. - Updated the repository URL in the Dockerfile to use the specified APK mirror if provided. - Enhanced runtime dependencies installation by including additional packages and updating pip before installing uvx. --- docker/Dockerfile.app | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile.app b/docker/Dockerfile.app index 52a444b3..58c5d253 100644 --- a/docker/Dockerfile.app +++ b/docker/Dockerfile.app @@ -7,6 +7,7 @@ WORKDIR /app ARG GOPRIVATE_ARG ARG GOPROXY_ARG ARG GOSUMDB_ARG=off +ARG APK_MIRROR_ARG="mirrors.tencent.com" # 设置Go环境变量 ENV GOPRIVATE=${GOPRIVATE_ARG} @@ -14,7 +15,9 @@ ENV GOPROXY=${GOPROXY_ARG} ENV GOSUMDB=${GOSUMDB_ARG} # Install dependencies -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \ +RUN if [ -n "$APK_MIRROR_ARG" ]; then \ + sed -i "s@dl-cdn.alpinelinux.org@${APK_MIRROR_ARG}@g" /etc/apk/repositories; \ + fi && \ apk add --no-cache git build-base # Install migrate tool @@ -46,13 +49,18 @@ FROM alpine:3.17 WORKDIR /app -# Install runtime dependencies -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \ +ARG APK_MIRROR_ARG="mirrors.tencent.com" + +RUN if [ -n "$APK_MIRROR_ARG" ]; then \ + sed -i "s@dl-cdn.alpinelinux.org@${APK_MIRROR_ARG}@g" /etc/apk/repositories; \ + fi && \ apk update && apk upgrade && \ apk add --no-cache build-base postgresql-client mysql-client ca-certificates tzdata sed curl bash vim wget \ - nodejs npm python3 py3-pip && \ - pip3 install --no-cache-dir pipx && \ - pipx install uvx + nodejs npm python3 py3-pip python3-dev libffi-dev openssl-dev cargo && \ + python3 -m pip install --upgrade pip setuptools wheel && \ + # 使用官方安装脚本安装 uvx + curl -LsSf https://astral.sh/uv/install.sh | sh && \ + ln -sf /root/.cargo/bin/uvx /usr/local/bin/uvx # Create a non-root user and switch to it RUN mkdir -p /data/files && \