Commit 54eade7a authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

chore: 更新构建配置以支持额外的PyPI镜像源

parent c2504395
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -61,4 +61,5 @@ external/
data/

# Generated during Ansible variable import
docker-celery-3.0.5/deploy_configs/**/variables_parsed.json
docker-celery-3.0.5/api_gateway/ccds/
docker-celery-3.0.5/api_gateway/csst-dfs-client/
+5 −1
Original line number Diff line number Diff line
@@ -3,7 +3,8 @@
BUILD_NUMBER ?= latest
HARBOR_PROJECT ?= 
SKIP_JS9 ?= 1
PIP_INDEX_URL ?=
PIP_INDEX_URL ?= https://pypi.tuna.tsinghua.edu.cn/simple/
PIP_EXTRA_INDEX_URL ?= https://mirrors.bfsu.edu.cn/pypi/web/simple
PIP_TRUSTED_HOST ?=
PIP_DEFAULT_TIMEOUT ?= 120
PIP_RETRIES ?= 5
@@ -31,6 +32,9 @@ API_GATEWAY_BUILD_ARGS := --build-arg PIP_DEFAULT_TIMEOUT=$(PIP_DEFAULT_TIMEOUT)
ifneq ($(strip $(PIP_INDEX_URL)),)
API_GATEWAY_BUILD_ARGS += --build-arg PIP_INDEX_URL=$(PIP_INDEX_URL)
endif
ifneq ($(strip $(PIP_EXTRA_INDEX_URL)),)
API_GATEWAY_BUILD_ARGS += --build-arg PIP_EXTRA_INDEX_URL=$(PIP_EXTRA_INDEX_URL)
endif
ifneq ($(strip $(PIP_TRUSTED_HOST)),)
API_GATEWAY_BUILD_ARGS += --build-arg PIP_TRUSTED_HOST=$(PIP_TRUSTED_HOST)
endif
+5 −2
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
ARG PIP_INDEX_URL
ARG PIP_EXTRA_INDEX_URL
ARG PIP_TRUSTED_HOST
ARG PIP_DEFAULT_TIMEOUT=120
ARG PIP_RETRIES=5
@@ -12,13 +13,15 @@ COPY ccds /app/ccds/
RUN set -e; \
    pip_args="--no-cache-dir --default-timeout=${PIP_DEFAULT_TIMEOUT} --retries=${PIP_RETRIES}"; \
    if [ -n "${PIP_INDEX_URL}" ]; then pip_args="$pip_args -i ${PIP_INDEX_URL}"; fi; \
    if [ -n "${PIP_TRUSTED_HOST}" ]; then pip_args="$pip_args --trusted-host ${PIP_TRUSTED_HOST}"; fi; \
    if [ -n "${PIP_EXTRA_INDEX_URL}" ]; then for url in ${PIP_EXTRA_INDEX_URL}; do pip_args="$pip_args --extra-index-url ${url}"; done; fi; \
    if [ -n "${PIP_TRUSTED_HOST}" ]; then for host in ${PIP_TRUSTED_HOST}; do pip_args="$pip_args --trusted-host ${host}"; done; fi; \
    pip install $pip_args -r requirements.txt; \
    if [ -f "/app/csst-dfs-client/setup.py" ] || [ -f "/app/csst-dfs-client/pyproject.toml" ]; then pip install $pip_args /app/csst-dfs-client/; fi
RUN set -e; \
    pip_args="--no-cache-dir --default-timeout=${PIP_DEFAULT_TIMEOUT} --retries=${PIP_RETRIES}"; \
    if [ -n "${PIP_INDEX_URL}" ]; then pip_args="$pip_args -i ${PIP_INDEX_URL}"; fi; \
    if [ -n "${PIP_TRUSTED_HOST}" ]; then pip_args="$pip_args --trusted-host ${PIP_TRUSTED_HOST}"; fi; \
    if [ -n "${PIP_EXTRA_INDEX_URL}" ]; then for url in ${PIP_EXTRA_INDEX_URL}; do pip_args="$pip_args --extra-index-url ${url}"; done; fi; \
    if [ -n "${PIP_TRUSTED_HOST}" ]; then for host in ${PIP_TRUSTED_HOST}; do pip_args="$pip_args --trusted-host ${host}"; done; fi; \
    if [ -f "/app/ccds/setup.py" ] || [ -f "/app/ccds/pyproject.toml" ]; then pip install $pip_args /app/ccds/; fi

COPY . .