From 5ec4686258f209049fa3f951f8f65ad0ffa9caab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=82=85=E5=93=A5?= <184172133@qq.com> Date: Thu, 19 Jan 2023 14:52:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E5=82=85=E5=93=A5=EF=BC=8Cfeat?= =?UTF-8?q?=EF=BC=9A=E7=AC=AC6=E8=8A=82=EF=BC=9A=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=88=B0=20Docker=20=E5=AE=B9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 13 +++++ build.sh | 1 + chatbot-api-interfaces/pom.xml | 54 +++++++++++++++++++ .../src/main/resources/application.yml | 2 +- ...15\345\212\241\345\274\200\345\217\221.md" | 0 ...03\347\224\250\346\216\245\345\217\243.md" | 0 ...50\345\214\226\345\233\236\347\255\224.md" | 0 ...10\260 Docker \345\256\271\345\231\250.md" | 12 +++++ pom.xml | 4 -- start.sh | 1 + 10 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 Dockerfile create mode 100644 build.sh create mode 100644 "docs/md/\347\254\2543\350\212\202\357\274\232\347\237\245\350\257\206\346\230\237\347\220\203\346\216\245\345\217\243\351\242\206\345\237\237\346\234\215\345\212\241\345\274\200\345\217\221.md" create mode 100644 "docs/md/\347\254\2544\350\212\202\357\274\232\345\257\271\346\216\245ChatGPT\357\274\214\350\260\203\347\224\250\346\216\245\345\217\243.md" create mode 100644 "docs/md/\347\254\2545\350\212\202\357\274\232\346\225\264\345\220\210\347\237\245\350\257\206\346\230\237\347\220\203\344\270\216ChatGPT\357\274\214\345\256\214\346\210\220\350\207\252\345\212\250\345\214\226\345\233\236\347\255\224.md" create mode 100644 "docs/md/\347\254\2546\350\212\202\357\274\232\351\203\250\347\275\262\346\234\215\345\212\241\345\210\260 Docker \345\256\271\345\231\250.md" create mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f15fbbf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +# 基础镜像 +FROM openjdk:8-jre-slim +# 作者 +MAINTAINER xiaofuge +# 配置 +ENV PARAMS="" +# 时区 +ENV TZ=PRC +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +# 添加应用 +ADD /chatbot-api-interfaces/target/chatbot-api.jar /chatbot-api.jar +# 执行镜像 +ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /chatbot-api.jar $PARAMS"] \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..9e5de09 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ + docker build -f ./Dockerfile -t chatbot-api:1.0 . \ No newline at end of file diff --git a/chatbot-api-interfaces/pom.xml b/chatbot-api-interfaces/pom.xml index a405f43..6e6ce45 100644 --- a/chatbot-api-interfaces/pom.xml +++ b/chatbot-api-interfaces/pom.xml @@ -9,6 +9,8 @@ 4.0.0 + jar + chatbot-api-interfaces @@ -85,4 +87,56 @@ + + chatbot-api + + + src/main/resources + true + + **/** + + + + + + src/test/resources + true + + **/** + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12.4 + + true + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + \ No newline at end of file diff --git a/chatbot-api-interfaces/src/main/resources/application.yml b/chatbot-api-interfaces/src/main/resources/application.yml index 0aa062a..bcf4f4c 100644 --- a/chatbot-api-interfaces/src/main/resources/application.yml +++ b/chatbot-api-interfaces/src/main/resources/application.yml @@ -4,4 +4,4 @@ server: chatbot-api: groupId: 28885518425541 cookie: __cuid=5330a556392a4c5b8084b4cbc165e0f3; amp_fef1e8=930aec23-e22e-4f11-8864-0389bd5095d1R...1g55hl79m.1g55hl79t.1.1.2; UM_distinctid=183e61195d535b-0bddac94679c75-19525635-1aeaa0-183e61195d7c52; sensorsdata2015jssdkcross={"distinct_id":"241858242255511","first_id":"17ebd0b4317ecb-0b27f672c2d3af-133a6253-1296000-17ebd0b4318ba7","props":{"$latest_traffic_source_type":"直接流量","$latest_search_keyword":"未取到值_直接打开","$latest_referrer":""},"$device_id":"17ebd0b4317ecb-0b27f672c2d3af-133a6253-1296000-17ebd0b4318ba7","identities":"eyIkaWRlbnRpdHlfY29va2llX2lkIjoiMTgwMmQ2YjZiOWIxZjMtMGQ4YzMzZjhmYTA3YmEtMzU3MzZhMDMtMTI5NjAwMC0xODAyZDZiNmI5YzEwODYiLCIkaWRlbnRpdHlfbG9naW5faWQiOiIyNDE4NTgyNDIyNTU1MTEifQ==","history_login_id":{"name":"$identity_login_id","value":"241858242255511"}}; abtest_env=product; zsxqsessionid=8fae9a083a4874ab833c2158a44deb82; zsxq_access_token=5D862869-1229-A9B6-1BC1-C662EC4B16DD_D625BA7FD9CBBDFA - openAiKey: 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 \ No newline at end of file + openAiKey: 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 \ No newline at end of file diff --git "a/docs/md/\347\254\2543\350\212\202\357\274\232\347\237\245\350\257\206\346\230\237\347\220\203\346\216\245\345\217\243\351\242\206\345\237\237\346\234\215\345\212\241\345\274\200\345\217\221.md" "b/docs/md/\347\254\2543\350\212\202\357\274\232\347\237\245\350\257\206\346\230\237\347\220\203\346\216\245\345\217\243\351\242\206\345\237\237\346\234\215\345\212\241\345\274\200\345\217\221.md" new file mode 100644 index 0000000..e69de29 diff --git "a/docs/md/\347\254\2544\350\212\202\357\274\232\345\257\271\346\216\245ChatGPT\357\274\214\350\260\203\347\224\250\346\216\245\345\217\243.md" "b/docs/md/\347\254\2544\350\212\202\357\274\232\345\257\271\346\216\245ChatGPT\357\274\214\350\260\203\347\224\250\346\216\245\345\217\243.md" new file mode 100644 index 0000000..e69de29 diff --git "a/docs/md/\347\254\2545\350\212\202\357\274\232\346\225\264\345\220\210\347\237\245\350\257\206\346\230\237\347\220\203\344\270\216ChatGPT\357\274\214\345\256\214\346\210\220\350\207\252\345\212\250\345\214\226\345\233\236\347\255\224.md" "b/docs/md/\347\254\2545\350\212\202\357\274\232\346\225\264\345\220\210\347\237\245\350\257\206\346\230\237\347\220\203\344\270\216ChatGPT\357\274\214\345\256\214\346\210\220\350\207\252\345\212\250\345\214\226\345\233\236\347\255\224.md" new file mode 100644 index 0000000..e69de29 diff --git "a/docs/md/\347\254\2546\350\212\202\357\274\232\351\203\250\347\275\262\346\234\215\345\212\241\345\210\260 Docker \345\256\271\345\231\250.md" "b/docs/md/\347\254\2546\350\212\202\357\274\232\351\203\250\347\275\262\346\234\215\345\212\241\345\210\260 Docker \345\256\271\345\231\250.md" new file mode 100644 index 0000000..5a2ef75 --- /dev/null +++ "b/docs/md/\347\254\2546\350\212\202\357\274\232\351\203\250\347\275\262\346\234\215\345\212\241\345\210\260 Docker \345\256\271\345\231\250.md" @@ -0,0 +1,12 @@ +# 第6节:部署服务到 Docker 容器 + +## 资料 + +```java +vim /usr/lib/systemd/system/docker.service +在ExecStart=/usr/bin/dockerd-current 后面加上 -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock \ +重新加载配置文件 +systemctl daemon-reload +重启启动 +systemctl restart docker +``` \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4c71c24..df23ccf 100644 --- a/pom.xml +++ b/pom.xml @@ -118,10 +118,6 @@ true - - org.springframework.boot - spring-boot-maven-plugin - org.apache.maven.plugins maven-compiler-plugin diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..053ba2a --- /dev/null +++ b/start.sh @@ -0,0 +1 @@ +docker run -p 8090:8090 --name chatbot-api -d chatbot-api:1.0 \ No newline at end of file -- GitLab