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 سرور)
|
# پروکسی برای مرحله build (apt + pip از طریق VPN سرور)
|
||||||
ENV http_proxy=http://172.17.0.1:1081
|
ARG HTTP_PROXY=http://172.17.0.1:1081
|
||||||
ENV https_proxy=http://172.17.0.1:1081
|
ARG HTTPS_PROXY=http://172.17.0.1:1081
|
||||||
ENV HTTP_PROXY=http://172.17.0.1:1081
|
ENV http_proxy=${HTTP_PROXY}
|
||||||
ENV HTTPS_PROXY=http://172.17.0.1:1081
|
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
|
||||||
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 \
|
git \
|
||||||
util-linux \
|
util-linux \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
|
curl \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY requirements.txt .
|
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 . .
|
COPY . .
|
||||||
|
|
||||||
RUN mkdir -p /app/data
|
RUN mkdir -p /app/data
|
||||||
|
|
||||||
# حذف پروکسی برای runtime — برنامه مستقیم به میرورها وصل میشود
|
# حذف پروکسی برای runtime
|
||||||
RUN rm -f /etc/apt/apt.conf.d/99proxy
|
RUN rm -f /etc/apt/apt.conf.d/99proxy
|
||||||
ENV http_proxy= https_proxy= HTTP_PROXY= HTTPS_PROXY=
|
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
|
### ۱. 502 / 504 از Traefik
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
+8
-1
@@ -1,6 +1,13 @@
|
|||||||
services:
|
services:
|
||||||
mirror-manager:
|
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
|
container_name: mirror-manager
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
privileged: true
|
privileged: true
|
||||||
|
|||||||
Reference in New Issue
Block a user