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.

49 lines
1.3KB

  1. FROM python:3.7.9-alpine
  2. LABEL maintainer="foo@bar.com"
  3. ARG TZ='Asia/Shanghai'
  4. ARG CHATGPT_ON_WECHAT_VER=1.0.2
  5. ENV BUILD_PREFIX=/app \
  6. BUILD_OPEN_AI_API_KEY='YOUR OPEN AI KEY HERE'
  7. RUN apk add --no-cache \
  8. bash \
  9. curl \
  10. wget \
  11. gcc \
  12. g++ \
  13. ca-certificates \
  14. openssh \
  15. libffi-dev
  16. RUN wget -t 3 -T 30 -nv -O chatgpt-on-wechat-${CHATGPT_ON_WECHAT_VER}.tar.gz \
  17. https://github.com/zhayujie/chatgpt-on-wechat/archive/refs/tags/${CHATGPT_ON_WECHAT_VER}.tar.gz \
  18. && tar -xzf chatgpt-on-wechat-${CHATGPT_ON_WECHAT_VER}.tar.gz \
  19. && mv chatgpt-on-wechat-${CHATGPT_ON_WECHAT_VER} ${BUILD_PREFIX} \
  20. && rm chatgpt-on-wechat-${CHATGPT_ON_WECHAT_VER}.tar.gz
  21. WORKDIR ${BUILD_PREFIX}
  22. RUN cd ${BUILD_PREFIX} \
  23. && cp config-template.json ${BUILD_PREFIX}/config.json \
  24. && sed -i "2s/YOUR API KEY/${BUILD_OPEN_AI_API_KEY}/" ${BUILD_PREFIX}/config.json
  25. RUN /usr/local/bin/python -m pip install --no-cache --upgrade pip \
  26. && pip install --no-cache \
  27. itchat-uos==1.5.0.dev0 \
  28. openai \
  29. wechaty
  30. ADD ./entrypoint.sh /entrypoint.sh
  31. RUN chmod +x /entrypoint.sh
  32. RUN adduser -D -h /home/noroot -u 1000 -s /bin/bash noroot \
  33. && chown noroot:noroot ${BUILD_PREFIX}
  34. USER noroot
  35. ENTRYPOINT ["/entrypoint.sh"]