From 12c170f2274b04584e5cd927baf6e12566b657db Mon Sep 17 00:00:00 2001 From: zhayujie Date: Mon, 26 Jun 2023 14:05:08 +0800 Subject: [PATCH] chore: remove useless docker files --- docker/Dockerfile.alpine | 39 ------ docker/Dockerfile.alpine.latest | 29 ----- docker/Dockerfile.debian | 41 ------ docker/build.alpine.sh | 15 --- docker/build.debian.sh | 15 --- .../Dockerfile.alpine | 23 ---- .../Dockerfile.debian | 24 ---- .../docker-compose.yaml | 24 ---- .../entrypoint.sh | 117 ------------------ docker/sample-chatgpt-on-wechat/.env | 16 --- docker/sample-chatgpt-on-wechat/Makefile | 26 ---- docker/sample-chatgpt-on-wechat/Name | 1 - 12 files changed, 370 deletions(-) delete mode 100644 docker/Dockerfile.alpine delete mode 100644 docker/Dockerfile.alpine.latest delete mode 100644 docker/Dockerfile.debian delete mode 100644 docker/build.alpine.sh delete mode 100644 docker/build.debian.sh delete mode 100644 docker/chatgpt-on-wechat-voice-reply/Dockerfile.alpine delete mode 100644 docker/chatgpt-on-wechat-voice-reply/Dockerfile.debian delete mode 100644 docker/chatgpt-on-wechat-voice-reply/docker-compose.yaml delete mode 100755 docker/chatgpt-on-wechat-voice-reply/entrypoint.sh delete mode 100644 docker/sample-chatgpt-on-wechat/.env delete mode 100644 docker/sample-chatgpt-on-wechat/Makefile delete mode 100644 docker/sample-chatgpt-on-wechat/Name diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine deleted file mode 100644 index 61f80c2..0000000 --- a/docker/Dockerfile.alpine +++ /dev/null @@ -1,39 +0,0 @@ -FROM python:3.10-alpine - -LABEL maintainer="foo@bar.com" -ARG TZ='Asia/Shanghai' - -ARG CHATGPT_ON_WECHAT_VER - -ENV BUILD_PREFIX=/app - -RUN apk add --no-cache \ - bash \ - curl \ - wget \ - && export BUILD_GITHUB_TAG=${CHATGPT_ON_WECHAT_VER:-`curl -sL "https://api.github.com/repos/zhayujie/chatgpt-on-wechat/releases/latest" | \ - grep '"tag_name":' | \ - sed -E 's/.*"([^"]+)".*/\1/'`} \ - && wget -t 3 -T 30 -nv -O chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \ - https://github.com/zhayujie/chatgpt-on-wechat/archive/refs/tags/${BUILD_GITHUB_TAG}.tar.gz \ - && tar -xzf chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \ - && mv chatgpt-on-wechat-${BUILD_GITHUB_TAG} ${BUILD_PREFIX} \ - && rm chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \ - && cd ${BUILD_PREFIX} \ - && cp config-template.json ${BUILD_PREFIX}/config.json \ - && /usr/local/bin/python -m pip install --no-cache --upgrade pip \ - && pip install --no-cache -r requirements.txt --extra-index-url https://alpine-wheels.github.io/index\ - && pip install --no-cache -r requirements-optional.txt --extra-index-url https://alpine-wheels.github.io/index\ - && apk del curl wget - -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 -R noroot:noroot ${BUILD_PREFIX} - -USER noroot - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/Dockerfile.alpine.latest b/docker/Dockerfile.alpine.latest deleted file mode 100644 index dfcfa66..0000000 --- a/docker/Dockerfile.alpine.latest +++ /dev/null @@ -1,29 +0,0 @@ -FROM python:3.10-alpine - -LABEL maintainer="foo@bar.com" -ARG TZ='Asia/Shanghai' - -ARG CHATGPT_ON_WECHAT_VER - -ENV BUILD_PREFIX=/app - -ADD . ${BUILD_PREFIX} - -RUN apk add --no-cache bash ffmpeg espeak \ - && cd ${BUILD_PREFIX} \ - && cp config-template.json config.json \ - && /usr/local/bin/python -m pip install --no-cache --upgrade pip \ - && pip install --no-cache -r requirements.txt --extra-index-url https://alpine-wheels.github.io/index\ - && pip install --no-cache -r requirements-optional.txt --extra-index-url https://alpine-wheels.github.io/index - -WORKDIR ${BUILD_PREFIX} - -ADD docker/entrypoint.sh /entrypoint.sh - -RUN chmod +x /entrypoint.sh \ - && adduser -D -h /home/noroot -u 1000 -s /bin/bash noroot \ - && chown -R noroot:noroot ${BUILD_PREFIX} - -USER noroot - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian deleted file mode 100644 index 302fc4f..0000000 --- a/docker/Dockerfile.debian +++ /dev/null @@ -1,41 +0,0 @@ -FROM python:3.10 - -LABEL maintainer="foo@bar.com" -ARG TZ='Asia/Shanghai' - -ARG CHATGPT_ON_WECHAT_VER - -ENV BUILD_PREFIX=/app - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - wget \ - curl \ - && rm -rf /var/lib/apt/lists/* \ - && export BUILD_GITHUB_TAG=${CHATGPT_ON_WECHAT_VER:-`curl -sL "https://api.github.com/repos/zhayujie/chatgpt-on-wechat/releases/latest" | \ - grep '"tag_name":' | \ - sed -E 's/.*"([^"]+)".*/\1/'`} \ - && wget -t 3 -T 30 -nv -O chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \ - https://github.com/zhayujie/chatgpt-on-wechat/archive/refs/tags/${BUILD_GITHUB_TAG}.tar.gz \ - && tar -xzf chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \ - && mv chatgpt-on-wechat-${BUILD_GITHUB_TAG} ${BUILD_PREFIX} \ - && rm chatgpt-on-wechat-${BUILD_GITHUB_TAG}.tar.gz \ - && cd ${BUILD_PREFIX} \ - && cp config-template.json ${BUILD_PREFIX}/config.json \ - && /usr/local/bin/python -m pip install --no-cache --upgrade pip \ - && pip install --no-cache -r requirements.txt \ - && pip install --no-cache -r requirements-optional.txt - -WORKDIR ${BUILD_PREFIX} - -ADD ./entrypoint.sh /entrypoint.sh - -RUN chmod +x /entrypoint.sh \ - && mkdir -p /home/noroot \ - && groupadd -r noroot \ - && useradd -r -g noroot -s /bin/bash -d /home/noroot noroot \ - && chown -R noroot:noroot /home/noroot ${BUILD_PREFIX} /usr/local/lib - -USER noroot - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/build.alpine.sh b/docker/build.alpine.sh deleted file mode 100644 index fae7b34..0000000 --- a/docker/build.alpine.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# fetch latest release tag -CHATGPT_ON_WECHAT_TAG=`curl -sL "https://api.github.com/repos/zhayujie/chatgpt-on-wechat/releases/latest" | \ - grep '"tag_name":' | \ - sed -E 's/.*"([^"]+)".*/\1/'` - -# build image -docker build -f Dockerfile.alpine \ - --build-arg CHATGPT_ON_WECHAT_VER=$CHATGPT_ON_WECHAT_TAG \ - -t zhayujie/chatgpt-on-wechat . - -# tag image -docker tag zhayujie/chatgpt-on-wechat zhayujie/chatgpt-on-wechat:alpine -docker tag zhayujie/chatgpt-on-wechat zhayujie/chatgpt-on-wechat:$CHATGPT_ON_WECHAT_TAG-alpine diff --git a/docker/build.debian.sh b/docker/build.debian.sh deleted file mode 100644 index 9b2d4f3..0000000 --- a/docker/build.debian.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# fetch latest release tag -CHATGPT_ON_WECHAT_TAG=`curl -sL "https://api.github.com/repos/zhayujie/chatgpt-on-wechat/releases/latest" | \ - grep '"tag_name":' | \ - sed -E 's/.*"([^"]+)".*/\1/'` - -# build image -docker build -f Dockerfile.debian \ - --build-arg CHATGPT_ON_WECHAT_VER=$CHATGPT_ON_WECHAT_TAG \ - -t zhayujie/chatgpt-on-wechat . - -# tag image -docker tag zhayujie/chatgpt-on-wechat zhayujie/chatgpt-on-wechat:debian -docker tag zhayujie/chatgpt-on-wechat zhayujie/chatgpt-on-wechat:$CHATGPT_ON_WECHAT_TAG-debian \ No newline at end of file diff --git a/docker/chatgpt-on-wechat-voice-reply/Dockerfile.alpine b/docker/chatgpt-on-wechat-voice-reply/Dockerfile.alpine deleted file mode 100644 index 91e9428..0000000 --- a/docker/chatgpt-on-wechat-voice-reply/Dockerfile.alpine +++ /dev/null @@ -1,23 +0,0 @@ -FROM zhayujie/chatgpt-on-wechat:alpine - -LABEL maintainer="foo@bar.com" -ARG TZ='Asia/Shanghai' - -USER root - -RUN apk add --no-cache \ - ffmpeg \ - espeak \ - && pip install --no-cache \ - baidu-aip \ - chardet \ - SpeechRecognition - -# replace entrypoint -ADD ./entrypoint.sh /entrypoint.sh - -RUN chmod +x /entrypoint.sh - -USER noroot - -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/chatgpt-on-wechat-voice-reply/Dockerfile.debian b/docker/chatgpt-on-wechat-voice-reply/Dockerfile.debian deleted file mode 100644 index df58d02..0000000 --- a/docker/chatgpt-on-wechat-voice-reply/Dockerfile.debian +++ /dev/null @@ -1,24 +0,0 @@ -FROM zhayujie/chatgpt-on-wechat:debian - -LABEL maintainer="foo@bar.com" -ARG TZ='Asia/Shanghai' - -USER root - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - ffmpeg \ - espeak \ - && pip install --no-cache \ - baidu-aip \ - chardet \ - SpeechRecognition - -# replace entrypoint -ADD ./entrypoint.sh /entrypoint.sh - -RUN chmod +x /entrypoint.sh - -USER noroot - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/chatgpt-on-wechat-voice-reply/docker-compose.yaml b/docker/chatgpt-on-wechat-voice-reply/docker-compose.yaml deleted file mode 100644 index 95ace28..0000000 --- a/docker/chatgpt-on-wechat-voice-reply/docker-compose.yaml +++ /dev/null @@ -1,24 +0,0 @@ -version: '2.0' -services: - chatgpt-on-wechat: - build: - context: ./ - dockerfile: Dockerfile.alpine - image: zhayujie/chatgpt-on-wechat-voice-reply - container_name: chatgpt-on-wechat-voice-reply - environment: - OPEN_AI_API_KEY: 'YOUR API KEY' - OPEN_AI_PROXY: '' - SINGLE_CHAT_PREFIX: '["bot", "@bot"]' - SINGLE_CHAT_REPLY_PREFIX: '"[bot] "' - GROUP_CHAT_PREFIX: '["@bot"]' - GROUP_NAME_WHITE_LIST: '["ChatGPT测试群", "ChatGPT测试群2"]' - IMAGE_CREATE_PREFIX: '["画", "看", "找"]' - CONVERSATION_MAX_TOKENS: 1000 - SPEECH_RECOGNITION: 'true' - CHARACTER_DESC: '你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。' - EXPIRES_IN_SECONDS: 3600 - VOICE_REPLY_VOICE: 'true' - BAIDU_APP_ID: 'YOUR BAIDU APP ID' - BAIDU_API_KEY: 'YOUR BAIDU API KEY' - BAIDU_SECRET_KEY: 'YOUR BAIDU SERVICE KEY' \ No newline at end of file diff --git a/docker/chatgpt-on-wechat-voice-reply/entrypoint.sh b/docker/chatgpt-on-wechat-voice-reply/entrypoint.sh deleted file mode 100755 index 81241f3..0000000 --- a/docker/chatgpt-on-wechat-voice-reply/entrypoint.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -set -e - -# build prefix -CHATGPT_ON_WECHAT_PREFIX=${CHATGPT_ON_WECHAT_PREFIX:-""} -# path to config.json -CHATGPT_ON_WECHAT_CONFIG_PATH=${CHATGPT_ON_WECHAT_CONFIG_PATH:-""} -# execution command line -CHATGPT_ON_WECHAT_EXEC=${CHATGPT_ON_WECHAT_EXEC:-""} - -OPEN_AI_API_KEY=${OPEN_AI_API_KEY:-""} -OPEN_AI_PROXY=${OPEN_AI_PROXY:-""} -SINGLE_CHAT_PREFIX=${SINGLE_CHAT_PREFIX:-""} -SINGLE_CHAT_REPLY_PREFIX=${SINGLE_CHAT_REPLY_PREFIX:-""} -GROUP_CHAT_PREFIX=${GROUP_CHAT_PREFIX:-""} -GROUP_NAME_WHITE_LIST=${GROUP_NAME_WHITE_LIST:-""} -IMAGE_CREATE_PREFIX=${IMAGE_CREATE_PREFIX:-""} -CONVERSATION_MAX_TOKENS=${CONVERSATION_MAX_TOKENS:-""} -SPEECH_RECOGNITION=${SPEECH_RECOGNITION:-""} -CHARACTER_DESC=${CHARACTER_DESC:-""} -EXPIRES_IN_SECONDS=${EXPIRES_IN_SECONDS:-""} - -VOICE_REPLY_VOICE=${VOICE_REPLY_VOICE:-""} -BAIDU_APP_ID=${BAIDU_APP_ID:-""} -BAIDU_API_KEY=${BAIDU_API_KEY:-""} -BAIDU_SECRET_KEY=${BAIDU_SECRET_KEY:-""} - -# CHATGPT_ON_WECHAT_PREFIX is empty, use /app -if [ "$CHATGPT_ON_WECHAT_PREFIX" == "" ] ; then - CHATGPT_ON_WECHAT_PREFIX=/app -fi - -# CHATGPT_ON_WECHAT_CONFIG_PATH is empty, use '/app/config.json' -if [ "$CHATGPT_ON_WECHAT_CONFIG_PATH" == "" ] ; then - CHATGPT_ON_WECHAT_CONFIG_PATH=$CHATGPT_ON_WECHAT_PREFIX/config.json -fi - -# CHATGPT_ON_WECHAT_EXEC is empty, use ‘python app.py’ -if [ "$CHATGPT_ON_WECHAT_EXEC" == "" ] ; then - CHATGPT_ON_WECHAT_EXEC="python app.py" -fi - -# modify content in config.json -if [ "$OPEN_AI_API_KEY" != "" ] ; then - sed -i "s/\"open_ai_api_key\".*,$/\"open_ai_api_key\": \"$OPEN_AI_API_KEY\",/" $CHATGPT_ON_WECHAT_CONFIG_PATH -else - echo -e "\033[31m[Warning] You need to set OPEN_AI_API_KEY before running!\033[0m" -fi - -# use http_proxy as default -if [ "$HTTP_PROXY" != "" ] ; then - sed -i "s/\"proxy\".*,$/\"proxy\": \"$HTTP_PROXY\",/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$OPEN_AI_PROXY" != "" ] ; then - sed -i "s/\"proxy\".*,$/\"proxy\": \"$OPEN_AI_PROXY\",/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$SINGLE_CHAT_PREFIX" != "" ] ; then - sed -i "s/\"single_chat_prefix\".*,$/\"single_chat_prefix\": $SINGLE_CHAT_PREFIX,/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$SINGLE_CHAT_REPLY_PREFIX" != "" ] ; then - sed -i "s/\"single_chat_reply_prefix\".*,$/\"single_chat_reply_prefix\": $SINGLE_CHAT_REPLY_PREFIX,/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$GROUP_CHAT_PREFIX" != "" ] ; then - sed -i "s/\"group_chat_prefix\".*,$/\"group_chat_prefix\": $GROUP_CHAT_PREFIX,/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$GROUP_NAME_WHITE_LIST" != "" ] ; then - sed -i "s/\"group_name_white_list\".*,$/\"group_name_white_list\": $GROUP_NAME_WHITE_LIST,/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$IMAGE_CREATE_PREFIX" != "" ] ; then - sed -i "s/\"image_create_prefix\".*,$/\"image_create_prefix\": $IMAGE_CREATE_PREFIX,/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$CONVERSATION_MAX_TOKENS" != "" ] ; then - sed -i "s/\"conversation_max_tokens\".*,$/\"conversation_max_tokens\": $CONVERSATION_MAX_TOKENS,/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$SPEECH_RECOGNITION" != "" ] ; then - sed -i "s/\"speech_recognition\".*,$/\"speech_recognition\": $SPEECH_RECOGNITION,/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$CHARACTER_DESC" != "" ] ; then - sed -i "s/\"character_desc\".*,$/\"character_desc\": \"$CHARACTER_DESC\",/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$EXPIRES_IN_SECONDS" != "" ] ; then - sed -i "s/\"expires_in_seconds\".*$/\"expires_in_seconds\": $EXPIRES_IN_SECONDS/" $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -# append -if [ "$BAIDU_SECRET_KEY" != "" ] ; then - sed -i "1a \ \ \"baidu_secret_key\": \"$BAIDU_SECRET_KEY\"," $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$BAIDU_API_KEY" != "" ] ; then - sed -i "1a \ \ \"baidu_api_key\": \"$BAIDU_API_KEY\"," $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$BAIDU_APP_ID" != "" ] ; then - sed -i "1a \ \ \"baidu_app_id\": \"$BAIDU_APP_ID\"," $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -if [ "$VOICE_REPLY_VOICE" != "" ] ; then - sed -i "1a \ \ \"voice_reply_voice\": $VOICE_REPLY_VOICE," $CHATGPT_ON_WECHAT_CONFIG_PATH -fi - -# go to prefix dir -cd $CHATGPT_ON_WECHAT_PREFIX -# excute -$CHATGPT_ON_WECHAT_EXEC - - diff --git a/docker/sample-chatgpt-on-wechat/.env b/docker/sample-chatgpt-on-wechat/.env deleted file mode 100644 index 9a65cec..0000000 --- a/docker/sample-chatgpt-on-wechat/.env +++ /dev/null @@ -1,16 +0,0 @@ -OPEN_AI_API_KEY=YOUR API KEY -OPEN_AI_PROXY= -SINGLE_CHAT_PREFIX=["bot", "@bot"] -SINGLE_CHAT_REPLY_PREFIX="[bot] " -GROUP_CHAT_PREFIX=["@bot"] -GROUP_NAME_WHITE_LIST=["ChatGPT测试群", "ChatGPT测试群2"] -IMAGE_CREATE_PREFIX=["画", "看", "找"] -CONVERSATION_MAX_TOKENS=1000 -SPEECH_RECOGNITION=false -CHARACTER_DESC=你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。 -EXPIRES_IN_SECONDS=3600 - -# Optional -#CHATGPT_ON_WECHAT_PREFIX=/app -#CHATGPT_ON_WECHAT_CONFIG_PATH=/app/config.json -#CHATGPT_ON_WECHAT_EXEC=python app.py \ No newline at end of file diff --git a/docker/sample-chatgpt-on-wechat/Makefile b/docker/sample-chatgpt-on-wechat/Makefile deleted file mode 100644 index 4560634..0000000 --- a/docker/sample-chatgpt-on-wechat/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -IMG:=`cat Name` -MOUNT:= -PORT_MAP:= -DOTENV:=.env -CONTAINER_NAME:=sample-chatgpt-on-wechat - -echo: - echo $(IMG) - -run_d: - docker rm $(CONTAINER_NAME) || echo - docker run -dt --name $(CONTAINER_NAME) $(PORT_MAP) \ - --env-file=$(DOTENV) \ - $(MOUNT) $(IMG) - -run_i: - docker rm $(CONTAINER_NAME) || echo - docker run -it --name $(CONTAINER_NAME) $(PORT_MAP) \ - --env-file=$(DOTENV) \ - $(MOUNT) $(IMG) - -stop: - docker stop $(CONTAINER_NAME) - -rm: stop - docker rm $(CONTAINER_NAME) diff --git a/docker/sample-chatgpt-on-wechat/Name b/docker/sample-chatgpt-on-wechat/Name deleted file mode 100644 index 47a5dd5..0000000 --- a/docker/sample-chatgpt-on-wechat/Name +++ /dev/null @@ -1 +0,0 @@ -zhayujie/chatgpt-on-wechat