You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3KB

  1. FROM python:3.7.9
  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 \
  23. itchat-uos==1.5.0.dev0 \
  24. openai
  25. WORKDIR ${BUILD_PREFIX}
  26. ADD ./entrypoint.sh /entrypoint.sh
  27. RUN chmod +x /entrypoint.sh \
  28. && groupadd -r noroot \
  29. && useradd -r -g noroot -s /bin/bash -d /home/noroot noroot \
  30. && chown -R noroot:noroot ${BUILD_PREFIX}
  31. USER noroot
  32. ENTRYPOINT ["/entrypoint.sh"]