Dockerfile.backend 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. FROM python:3.11-slim
  2. WORKDIR /opt/maxkb-app
  3. ENV DEBIAN_FRONTEND=noninteractive \
  4. PYTHONDONTWRITEBYTECODE=1 \
  5. PYTHONUNBUFFERED=1 \
  6. HF_HOME=/opt/maxkb-app/model/base \
  7. TMPDIR=/opt/maxkb-app/tmp \
  8. PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple \
  9. PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn
  10. RUN rm -f /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources && \
  11. echo 'deb http://mirrors.aliyun.com/debian/ bookworm main non-free contrib' > /etc/apt/sources.list && \
  12. echo 'deb http://mirrors.aliyun.com/debian/ bookworm-updates main non-free contrib' >> /etc/apt/sources.list && \
  13. echo 'deb http://mirrors.aliyun.com/debian-security/ bookworm-security main non-free contrib' >> /etc/apt/sources.list && \
  14. apt-get update && apt-get install -y --no-install-recommends \
  15. build-essential \
  16. gcc \
  17. python3-dev \
  18. libpq-dev \
  19. curl \
  20. git \
  21. wget \
  22. && rm -rf /var/lib/apt/lists/*
  23. RUN pip install --no-cache-dir --upgrade pip setuptools wheel
  24. COPY pyproject.toml README.md ./
  25. COPY apps/ ./apps/
  26. COPY main.py ./
  27. RUN pip install .
  28. RUN pip install --no-cache-dir --break-system-packages torch==2.8.0 --index-url https://pypi.tuna.tsinghua.edu.cn/simple
  29. RUN mkdir -p /opt/maxkb-app/model/base /opt/maxkb-app/tmp /opt/maxkb-app/logs
  30. COPY start.sh /opt/maxkb-app/start.sh
  31. RUN chmod +x /opt/maxkb-app/start.sh
  32. EXPOSE 8080
  33. CMD ["/opt/maxkb-app/start.sh"]