Fix build hang: use Arvan mirror for base image and pip
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+16
-8
@@ -1,10 +1,14 @@
|
||||
FROM python:3.12-slim-bookworm
|
||||
# میرور آروان — بدون نیاز به دسترسی مستقیم Docker Hub
|
||||
ARG BASE_IMAGE=docker.arvancloud.ir/library/python:3.12-slim-bookworm
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# پروکسی برای مرحله build (دسترسی به PyPI و APT از طریق VPN سرور)
|
||||
ENV http_proxy=http://172.17.0.1:1081
|
||||
ENV https_proxy=http://172.17.0.1:1081
|
||||
ENV HTTP_PROXY=http://172.17.0.1:1081
|
||||
ENV HTTPS_PROXY=http://172.17.0.1:1081
|
||||
# پروکسی برای مرحله build (apt + pip از طریق VPN سرور)
|
||||
ARG HTTP_PROXY=http://172.17.0.1:1081
|
||||
ARG HTTPS_PROXY=http://172.17.0.1:1081
|
||||
ENV http_proxy=${HTTP_PROXY}
|
||||
ENV https_proxy=${HTTPS_PROXY}
|
||||
ENV HTTP_PROXY=${HTTP_PROXY}
|
||||
ENV HTTPS_PROXY=${HTTPS_PROXY}
|
||||
ENV no_proxy=localhost,127.0.0.1,172.17.0.1
|
||||
ENV NO_PROXY=localhost,127.0.0.1,172.17.0.1
|
||||
|
||||
@@ -15,18 +19,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
git \
|
||||
util-linux \
|
||||
ca-certificates \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN pip install --no-cache-dir \
|
||||
--index-url https://mirror.arvancloud.ir/pypi/simple \
|
||||
--trusted-host mirror.arvancloud.ir \
|
||||
-r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
# حذف پروکسی برای runtime — برنامه مستقیم به میرورها وصل میشود
|
||||
# حذف پروکسی برای runtime
|
||||
RUN rm -f /etc/apt/apt.conf.d/99proxy
|
||||
ENV http_proxy= https_proxy= HTTP_PROXY= HTTPS_PROXY=
|
||||
|
||||
|
||||
Reference in New Issue
Block a user