Dockerfile.backend 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 echo 'deb http://mirrors.aliyun.com/debian/ bookworm main non-free contrib' > /etc/apt/sources.list \
  11. && echo 'deb http://mirrors.aliyun.com/debian/ bookworm-updates main non-free contrib' >> /etc/apt/sources.list \
  12. && echo 'deb http://mirrors.aliyun.com/debian-security/ bookworm-security main non-free contrib' >> /etc/apt/sources.list \
  13. && apt-get update && apt-get install -y --no-install-recommends \
  14. build-essential \
  15. gcc \
  16. python3-dev \
  17. libpq-dev \
  18. curl \
  19. git \
  20. wget \
  21. && rm -rf /var/lib/apt/lists/*
  22. RUN pip install --no-cache-dir --upgrade pip setuptools wheel
  23. COPY pyproject.toml README.md ./
  24. COPY apps/ ./apps/
  25. COPY main.py ./
  26. RUN pip install .
  27. RUN pip install --no-cache-dir --break-system-packages torch==2.8.0 --index-url https://pypi.tuna.tsinghua.edu.cn/simple
  28. RUN mkdir -p /opt/maxkb-app/model/base /opt/maxkb-app/tmp /opt/maxkb-app/logs
  29. COPY start.sh /opt/maxkb-app/start.sh
  30. RUN chmod +x /opt/maxkb-app/start.sh
  31. EXPOSE 8080
  32. CMD ["/opt/maxkb-app/start.sh"]