Dockerfile.debian 1.4KB

1 年之前
12345678910111213141516171819202122232425262728293031323334353637383940
  1. FROM python:3.10
  2. LABEL maintainer="foo@bar.com"
  3. ARG TZ='Asia/Shanghai'
  4. ARG CHATGPT_ON_WECHAT_VER
  5. ENV BUILD_PREFIX=/app
  6. RUN apt-get update \
  7. && apt-get install -y --no-install-recommends \
  8. wget \
  9. curl \
  10. && rm -rf /var/lib/apt/lists/* \
  11. && export BUILD_GITHUB_TAG=${CHATGPT_ON_WECHAT_VER:-`curl -sL "https://api.github.com/repos/zhayujie/chatgpt-on-wechat/releases/latest" | \
  12. grep '"tag_name":' | \
  13. sed -E 's/.*"([^"]+)".*/\1/'`} \
  14. && wget -t 3 -T 30 -nv -O chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \
  15. https://github.com/zhayujie/chatgpt-on-wechat/archive/refs/tags/${BUILD_GITHUB_TAG}.tar.gz \
  16. && tar -xzf chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \
  17. && mv chatgpt-on-wechat-${BUILD_GITHUB_TAG} ${BUILD_PREFIX} \
  18. && rm chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \
  19. && cd ${BUILD_PREFIX} \
  20. && cp config-template.json ${BUILD_PREFIX}/config.json \
  21. && /usr/local/bin/python -m pip install --no-cache --upgrade pip \
  22. && pip install --no-cache -r requirements.txt \
  23. && pip install --no-cache -r requirements-optional.txt
  24. WORKDIR ${BUILD_PREFIX}
  25. ADD ./entrypoint.sh /entrypoint.sh
  26. RUN chmod +x /entrypoint.sh \
  27. && groupadd -r noroot \
  28. && useradd -r -g noroot -s /bin/bash -d /home/noroot noroot \
  29. && chown -R noroot:noroot ${BUILD_PREFIX}
  30. USER noroot
  31. ENTRYPOINT ["/entrypoint.sh"]