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.
This commit is contained in:
+14
-6
@@ -7,6 +7,7 @@ WORKDIR /app
|
|||||||
ARG GOPRIVATE_ARG
|
ARG GOPRIVATE_ARG
|
||||||
ARG GOPROXY_ARG
|
ARG GOPROXY_ARG
|
||||||
ARG GOSUMDB_ARG=off
|
ARG GOSUMDB_ARG=off
|
||||||
|
ARG APK_MIRROR_ARG="mirrors.tencent.com"
|
||||||
|
|
||||||
# 设置Go环境变量
|
# 设置Go环境变量
|
||||||
ENV GOPRIVATE=${GOPRIVATE_ARG}
|
ENV GOPRIVATE=${GOPRIVATE_ARG}
|
||||||
@@ -14,7 +15,9 @@ ENV GOPROXY=${GOPROXY_ARG}
|
|||||||
ENV GOSUMDB=${GOSUMDB_ARG}
|
ENV GOSUMDB=${GOSUMDB_ARG}
|
||||||
|
|
||||||
# Install dependencies
|
# 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
|
apk add --no-cache git build-base
|
||||||
|
|
||||||
# Install migrate tool
|
# Install migrate tool
|
||||||
@@ -46,13 +49,18 @@ FROM alpine:3.17
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install runtime dependencies
|
ARG APK_MIRROR_ARG="mirrors.tencent.com"
|
||||||
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 update && apk upgrade && \
|
apk update && apk upgrade && \
|
||||||
apk add --no-cache build-base postgresql-client mysql-client ca-certificates tzdata sed curl bash vim wget \
|
apk add --no-cache build-base postgresql-client mysql-client ca-certificates tzdata sed curl bash vim wget \
|
||||||
nodejs npm python3 py3-pip && \
|
nodejs npm python3 py3-pip python3-dev libffi-dev openssl-dev cargo && \
|
||||||
pip3 install --no-cache-dir pipx && \
|
python3 -m pip install --upgrade pip setuptools wheel && \
|
||||||
pipx install uvx
|
# 使用官方安装脚本安装 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
|
# Create a non-root user and switch to it
|
||||||
RUN mkdir -p /data/files && \
|
RUN mkdir -p /data/files && \
|
||||||
|
|||||||
Reference in New Issue
Block a user