mirror of https://github.com/fantasticit/think.git
chore: update docker config
This commit is contained in:
parent
a80dc769ce
commit
a0c3bf206b
|
@ -21,3 +21,4 @@ tsconfig.tsbuildinfo
|
|||
scripts/update.sh
|
||||
|
||||
output
|
||||
runtime
|
||||
|
|
11
Dockerfile
11
Dockerfile
|
@ -1,18 +1,13 @@
|
|||
FROM node:18-alpine as builder
|
||||
COPY . /app/
|
||||
COPY . /app/
|
||||
WORKDIR /app
|
||||
ARG EIP=mrdoc.fun
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
RUN npm i -g pm2 @nestjs/cli pnpm
|
||||
RUN apk --no-cache add bash
|
||||
RUN sed -i "s/localhost/$EIP/g" /app/docker/prod-sample.yaml
|
||||
RUN cp -f /app/docker/prod-sample.yaml /app/config/prod.yaml
|
||||
RUN apk --no-cache add bash
|
||||
RUN bash build-output.sh
|
||||
|
||||
|
||||
FROM node:18-alpine as prod
|
||||
LABEL maintainer="www.mrdoc.fun"
|
||||
ENV TZ=Asia/Shanghai
|
||||
COPY --from=builder /app/docker/* /app/docker/
|
||||
COPY --from=builder /app/output/ /app/
|
||||
|
@ -22,7 +17,7 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositorie
|
|||
RUN npm config set registry https://registry.npmmirror.com
|
||||
RUN set -x \
|
||||
&& apk update \
|
||||
&& apk add --no-cache tzdata redis \
|
||||
&& apk add --no-cache tzdata redis \
|
||||
&& chmod +x /app/docker/start.sh \
|
||||
&& npm i -g pm2 @nestjs/cli pnpm \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
|
|
@ -37,8 +37,8 @@ server:
|
|||
db:
|
||||
mysql:
|
||||
host: '127.0.0.1'
|
||||
username: 'root'
|
||||
password: 'root'
|
||||
username: 'think'
|
||||
password: 'think'
|
||||
database: 'think'
|
||||
port: 3306
|
||||
charset: 'utf8mb4'
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# 生产环境docker示例配置
|
||||
# 开发环境配置
|
||||
client:
|
||||
port: 5001
|
||||
assetPrefix: '/'
|
||||
apiUrl: 'http://localhost:5002/api'
|
||||
collaborationUrl: 'ws://localhost:5003/think/wss'
|
||||
collaborationUrl: 'ws://localhost:5003'
|
||||
# 以下为页面 meta 配置
|
||||
seoAppName: '云策文档'
|
||||
seoDescription: '云策文档是一款开源知识管理工具。通过独立的知识库空间,结构化地组织在线协作文档,实现知识的积累与沉淀,促进知识的复用与流通。'
|
||||
seoKeywords: '云策文档,协作,文档,前端面试题,fantasticit,https://github.com/fantasticit/think'
|
||||
seoKeywords: '云策文档,协作,文档,fantasticit,https://github.com/fantasticit/think'
|
||||
# 预先连接的来源,空格分割(比如图片存储服务器)
|
||||
dnsPrefetch: '//wipi.oss-cn-shanghai.aliyuncs.com'
|
||||
# 站点地址(如:http://think.codingit.cn/),一定要设置,否则会出现 cookie、跨域等问题
|
||||
|
@ -23,22 +23,31 @@ server:
|
|||
enableRateLimit: true # 是否限流
|
||||
rateLimitWindowMs: 60000 # 限流时间
|
||||
rateLimitMax: 1000 # 单位限流时间内单个 ip 最大访问数量
|
||||
email: # 邮箱服务,参考 http://help.163.com/09/1223/14/5R7P6CJ600753VB8.html?servCode=6010376 获取 SMTP 配置
|
||||
host: ''
|
||||
port: 465
|
||||
user: ''
|
||||
password: ''
|
||||
admin:
|
||||
name: 'sytemadmin' # 注意修改
|
||||
password: 'sytemadmin' # 注意修改
|
||||
email: 'sytemadmin@think.com' # 注意修改为真实邮箱地址
|
||||
|
||||
# 数据库配置
|
||||
db:
|
||||
mysql:
|
||||
host: 'mysql-with-think'
|
||||
username: 'jonnyan404'
|
||||
password: 'www.mrdoc.fun'
|
||||
host: 'mysql-for-think'
|
||||
username: 'think'
|
||||
password: 'think'
|
||||
database: 'think'
|
||||
port: 3306
|
||||
charset: 'utf8mb4'
|
||||
timezone: '+08:00'
|
||||
synchronize: true
|
||||
redis:
|
||||
host: '127.0.0.1'
|
||||
host: 'redis-for-think'
|
||||
port: '6379'
|
||||
password: ''
|
||||
password: 'root'
|
||||
|
||||
# oss 文件存储服务
|
||||
oss:
|
|
@ -1,44 +1,58 @@
|
|||
version: "3"
|
||||
version: '3'
|
||||
services:
|
||||
thinkdoc:
|
||||
think:
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
EIP: x.x.x.x # api接口IP,必须设置,可以是 IP 或者域名.
|
||||
image: think
|
||||
container_name: thinkdoc
|
||||
#restart: always
|
||||
container_name: think
|
||||
volumes:
|
||||
- /path/to/you/dir/config:/app/config # 请注意修改 /path/to/you/dir 为云策文档配置文件目录.
|
||||
- /path/to/you/dir/static:/app/packages/server/static # 请注意修改 /path/to/you/dir 为云策文档附件存储目录.
|
||||
- ./config:/app/config
|
||||
- ./runtime/static:/app/packages/server/static
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- "5001-5003:5001-5003"
|
||||
- '5001-5003:5001-5003'
|
||||
depends_on:
|
||||
- mysql
|
||||
- redis
|
||||
networks:
|
||||
- think
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
container_name: mysql-with-think
|
||||
#restart: always
|
||||
restart: always
|
||||
container_name: mysql-for-think
|
||||
volumes:
|
||||
- /path/to/you/dir/mysql:/var/lib/mysql # 请注意修改 /path/to/you/dir 为您要存储mysql数据的目录绝对路径.
|
||||
- ./runtime/mysql:/var/lib/mysql
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- MYSQL_ROOT_PASSWORD=Jonnyan404!
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
- MYSQL_DATABASE=think
|
||||
- MYSQL_USER=jonnyan404
|
||||
- MYSQL_PASSWORD=www.mrdoc.fun
|
||||
- MYSQL_USER=think
|
||||
- MYSQL_PASSWORD=think
|
||||
expose:
|
||||
- "3306"
|
||||
- '3306'
|
||||
ports:
|
||||
- "63306:3306" # 如果不需要外部连接mysql,可注释此行+上一行.
|
||||
- '3306:3306'
|
||||
command:
|
||||
- "--character-set-server=utf8mb4"
|
||||
- "--collation-server=utf8mb4_unicode_ci"
|
||||
# Volumes for persisting data, see https://docs.docker.com/engine/admin/volumes/volumes/
|
||||
#volumes:
|
||||
# thinkdoc-data:
|
||||
# driver: local
|
||||
# mysql-data:
|
||||
# driver: local
|
||||
- '--character-set-server=utf8mb4'
|
||||
- '--collation-server=utf8mb4_unicode_ci'
|
||||
networks:
|
||||
- think
|
||||
redis:
|
||||
image: redis:latest
|
||||
restart: always
|
||||
container_name: redis-for-think
|
||||
command: >
|
||||
--requirepass root
|
||||
expose:
|
||||
- '6379'
|
||||
ports:
|
||||
- '6379:6379'
|
||||
volumes:
|
||||
- ./runtime/redis:/data
|
||||
privileged: true
|
||||
networks:
|
||||
- think
|
||||
networks:
|
||||
think:
|
||||
driver: bridge
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/bin/sh
|
||||
### Author:jonnyan404
|
||||
### date:2022年5月22日
|
||||
|
||||
CONFIG_FILE='/app/config/prod.yaml'
|
||||
|
||||
if [ ! -f $CONFIG_FILE ]; then
|
||||
echo "#####Generating configuration file#####"
|
||||
cp /app/docker/prod-sample.yaml $CONFIG_FILE
|
||||
cp -f /app/config/docker-prod-sample.yaml $CONFIG_FILE
|
||||
else
|
||||
echo "#####Configuration file already exists#####"
|
||||
echo ""
|
||||
fi
|
||||
redis-server --daemonize yes
|
||||
|
||||
pnpm run pm2
|
||||
pm2 logs
|
||||
|
|
Loading…
Reference in New Issue