Fix deploy: main.py entrypoint and proxy Dockerfile for VPN build

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-05 19:58:30 +03:30
parent 9608342428
commit dfae55980a
3 changed files with 43 additions and 2 deletions
+16 -1
View File
@@ -1,5 +1,16 @@
FROM python:3.12-slim-bookworm FROM python:3.12-slim-bookworm
# پروکسی فقط برای مرحله 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
ENV no_proxy=localhost,127.0.0.1,172.17.0.1
ENV NO_PROXY=localhost,127.0.0.1,172.17.0.1
RUN echo 'Acquire::http::Proxy "http://172.17.0.1:1081";' > /etc/apt/apt.conf.d/99proxy && \
echo 'Acquire::https::Proxy "http://172.17.0.1:1081";' >> /etc/apt/apt.conf.d/99proxy
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
git \ git \
util-linux \ util-linux \
@@ -15,6 +26,10 @@ COPY . .
RUN mkdir -p /app/data RUN mkdir -p /app/data
# حذف پروکسی برای runtime — برنامه مستقیم به میرورها وصل می‌شود
RUN rm -f /etc/apt/apt.conf.d/99proxy
ENV http_proxy= https_proxy= HTTP_PROXY= HTTPS_PROXY=
ENV HOST_ROOT=/host ENV HOST_ROOT=/host
ENV DATA_DIR=/app/data ENV DATA_DIR=/app/data
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
@@ -24,4 +39,4 @@ EXPOSE 8765
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8765/login')" || exit 1 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8765/login')" || exit 1
CMD ["gunicorn", "-b", "0.0.0.0:8765", "-w", "2", "--timeout", "180", "run:app"] CMD ["python", "main.py"]
+2 -1
View File
@@ -144,7 +144,8 @@ openssl rand -hex 32
1. تب **Domains** 1. تب **Domains**
2. Host: `mirror.itistan.ir` 2. Host: `mirror.itistan.ir`
3. Port: `8765` 3. Port: **`8765`** (نه 3000)
4. Command در Dokploy باید **خالی** باشد — Dockerfile خودش `python main.py` را اجرا می‌کند
4. HTTPS: فعال / Let's Encrypt 4. HTTPS: فعال / Let's Encrypt
5. **Deploy** مجدد 5. **Deploy** مجدد
+25
View File
@@ -0,0 +1,25 @@
"""Entry point for container: python main.py"""
import subprocess
import sys
def main() -> None:
subprocess.run(
[
sys.executable,
"-m",
"gunicorn",
"-b",
"0.0.0.0:8765",
"-w",
"2",
"--timeout",
"180",
"run:app",
],
check=True,
)
if __name__ == "__main__":
main()