Fix build hang: use Arvan mirror for base image and pip
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
.git
|
||||
.venv
|
||||
venv
|
||||
__pycache__
|
||||
*.pyc
|
||||
data/
|
||||
.env
|
||||
*.db
|
||||
.cursor
|
||||
+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=
|
||||
|
||||
|
||||
@@ -210,6 +210,27 @@ git push origin main
|
||||
|
||||
## عیبیابی
|
||||
|
||||
### ۰. Build گیر میکند روی `load metadata for python`
|
||||
|
||||
علت: Docker Hub از ایران در دسترس نیست.
|
||||
|
||||
**راهحل (در Dockerfile اعمال شده):**
|
||||
- Base image از `docker.arvancloud.ir/library/python:3.12-slim-bookworm`
|
||||
- pip از `mirror.arvancloud.ir`
|
||||
|
||||
**قبل از deploy دستی روی سرور (اختیاری):**
|
||||
```bash
|
||||
docker pull docker.arvancloud.ir/library/python:3.12-slim-bookworm
|
||||
```
|
||||
|
||||
**اگر باز هم گیر کرد** — VPN را روشن کنید و دوباره Deploy بزنید.
|
||||
|
||||
**تست build دستی:**
|
||||
```bash
|
||||
cd /etc/dokploy/compose/vpn-mirror-sazg0b/code
|
||||
docker compose -p vpn-mirror-sazg0b build --progress=plain 2>&1 | tee /tmp/mirror-build.log
|
||||
```
|
||||
|
||||
### ۱. 502 / 504 از Traefik
|
||||
|
||||
```bash
|
||||
|
||||
+8
-1
@@ -1,6 +1,13 @@
|
||||
services:
|
||||
mirror-manager:
|
||||
build: .
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
network: host
|
||||
args:
|
||||
BASE_IMAGE: docker.arvancloud.ir/library/python:3.12-slim-bookworm
|
||||
HTTP_PROXY: http://172.17.0.1:1081
|
||||
HTTPS_PROXY: http://172.17.0.1:1081
|
||||
container_name: mirror-manager
|
||||
restart: unless-stopped
|
||||
privileged: true
|
||||
|
||||
Reference in New Issue
Block a user