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.

40 line
1.3KB

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