From ea5f7173bdd0468bb5a432649ad8484ba69857ab Mon Sep 17 00:00:00 2001 From: Look_World Date: Thu, 23 Mar 2023 16:27:36 +0800 Subject: [PATCH] =?UTF-8?q?1.Docker=E6=94=AF=E6=8C=81=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=AC;=202.=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E9=80=9F=E5=BA=A6=EF=BC=8C=E6=97=A0=E9=A1=BB?= =?UTF-8?q?=E5=86=8D=E6=AC=A1=E4=B8=8B=E8=BD=BD=E5=8C=85;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/Dockerfile.latest | 35 +++++++++++++++++++++++++++++++++++ docker/build.latest.sh | 8 ++++++++ 2 files changed, 43 insertions(+) create mode 100644 docker/Dockerfile.latest create mode 100644 docker/build.latest.sh diff --git a/docker/Dockerfile.latest b/docker/Dockerfile.latest new file mode 100644 index 0000000..fed4011 --- /dev/null +++ b/docker/Dockerfile.latest @@ -0,0 +1,35 @@ +FROM python:3.7.9-alpine + +LABEL maintainer="foo@bar.com" +ARG TZ='Asia/Shanghai' + +ARG CHATGPT_ON_WECHAT_VER + +ENV BUILD_PREFIX=/app \ + BUILD_OPEN_AI_API_KEY='YOUR OPEN AI KEY HERE' + +COPY chatgpt-on-wechat.tar.gz ./chatgpt-on-wechat.tar.gz + +RUN apk add --no-cache \ + bash \ + && tar -xf chatgpt-on-wechat.tar.gz \ + && mv chatgpt-on-wechat ${BUILD_PREFIX} \ + && cd ${BUILD_PREFIX} \ + && cp config-template.json ${BUILD_PREFIX}/config.json \ + && sed -i "2s/YOUR API KEY/${BUILD_OPEN_AI_API_KEY}/" ${BUILD_PREFIX}/config.json \ + && /usr/local/bin/python -m pip install --no-cache --upgrade pip \ + && pip install --no-cache \ + itchat-uos==1.5.0.dev0 \ + openai + +WORKDIR ${BUILD_PREFIX} + +ADD ./entrypoint.sh /entrypoint.sh + +RUN chmod +x /entrypoint.sh \ + && adduser -D -h /home/noroot -u 1000 -s /bin/bash noroot \ + && chown noroot:noroot ${BUILD_PREFIX} + +USER noroot + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/build.latest.sh b/docker/build.latest.sh new file mode 100644 index 0000000..d80e84c --- /dev/null +++ b/docker/build.latest.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# move chatgpt-on-wechat +tar -zcf chatgpt-on-wechat.tar.gz --exclude=../../chatgpt-on-wechat/docker ../../chatgpt-on-wechat + +# build image +docker build -f Dockerfile.alpine \ + -t zhayujie/chatgpt-on-wechat . \ No newline at end of file