[新服务] 自建alpine docker + chatgpt weekly report
date
Feb 19, 2023
slug
newservice-alpine-chatgpt-weekly-report
status
Published
summary
新服务 第一次自建
tags
service
type
Post
URL
Summary
- ‣ 没有docker,但想试试,就自建
步骤
#自建docker
export DOCKER_PROJ=chatgpt-weekly-report
mkdir /data/$DOCKER_PROJ; cd /data/$DOCKER_PROJ
cat > Dockerfile <<EOF
FROM alpine:latest
RUN apk add --update npm git
CMD ["tail", "-f", "/dev/null"]
EOF
docker build -t chatgpt-weekly-report .
cat > docker-compose.yml <<EOF
version: "3.8"
services:
chatgpt-weekly-report:
image: chatgpt-weekly-report
container_name: chatgpt-weekly-report
#volumes:
# - ./z:/mnt
#ports:
# - "127.0.0.1:3389:3389/tcp"
restart: unless-stopped
networks:
default:
name: npm_nginx_proxy_manager-network
external: true
EOF
docker-compose down; docker-compose up -d
/usr/bin/docker exec -it chatgpt-weekly-report sh
git clone https://github.com/guaguaguaxia/weekly_report
cd weekly_report
cat > .env <<EOF
OPENAI_API_KEY=YOU-OWN-API
NEXT_PUBLIC_USE_USER_KEY=false
# OPENAI_MODEL=text-chat-davinci-002-20221122
OPENAI_MODEL=text-davinci-003
EOF
npm install
npm run dev
Ctrl-p Ctrl-q # exit the container without stopping it