-
-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from Jonnyan404/main
- Loading branch information
Showing
5 changed files
with
186 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM node:18-alpine as builder | ||
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 http://registry.npm.taobao.org/ | ||
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 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/ | ||
|
||
WORKDIR /app | ||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | ||
RUN npm config set registry http://registry.npm.taobao.org/ | ||
RUN set -x \ | ||
&& apk update \ | ||
&& apk add --no-cache tzdata redis \ | ||
&& chmod +x /app/docker/start.sh \ | ||
&& npm i -g pm2 @nestjs/cli pnpm \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
ENTRYPOINT sh /app/docker/start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
version: "3" | ||
services: | ||
thinkdoc: | ||
build: | ||
context: . | ||
args: | ||
EIP: x.x.x.x # api接口IP,必须设置,可以是 IP 或者域名. | ||
image: think | ||
container_name: thinkdoc | ||
#restart: always | ||
volumes: | ||
- /path/to/you/dir/config:/app/config # 请注意修改 /path/to/you/dir 为云策文档配置文件目录. | ||
environment: | ||
- TZ=Asia/Shanghai | ||
ports: | ||
- "5001-5003:5001-5003" | ||
depends_on: | ||
- mysql | ||
mysql: | ||
image: mysql:5.7 | ||
container_name: mysql-with-think | ||
#restart: always | ||
volumes: | ||
- /path/to/you/dir/mysql:/var/lib/mysql # 请注意修改 /path/to/you/dir 为您要存储mysql数据的目录绝对路径. | ||
environment: | ||
- TZ=Asia/Shanghai | ||
- MYSQL_ROOT_PASSWORD=Jonnyan404! | ||
- MYSQL_DATABASE=think | ||
- MYSQL_USER=jonnyan404 | ||
- MYSQL_PASSWORD=www.mrdoc.fun | ||
expose: | ||
- "3306" | ||
ports: | ||
- "63306:3306" # 如果不需要外部连接mysql,可注释此行+上一行. | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# 生产环境docker示例配置 | ||
client: | ||
port: 5001 | ||
assetPrefix: '/' | ||
apiUrl: 'http://localhost:5002/api' | ||
collaborationUrl: 'ws://localhost:5003' | ||
# 以下为页面 meta 配置 | ||
seoAppName: '云策文档' | ||
seoDescription: '云策文档是一款开源知识管理工具。通过独立的知识库空间,结构化地组织在线协作文档,实现知识的积累与沉淀,促进知识的复用与流通。' | ||
seoKeywords: '云策文档,协作,文档,前端面试题,fantasticit,https://github.com/fantasticit/think' | ||
# 预先连接的来源,空格分割(比如图片存储服务器) | ||
dnsPrefetch: '//wipi.oss-cn-shanghai.aliyuncs.com' | ||
|
||
server: | ||
prefix: '/api' | ||
port: 5002 | ||
collaborationPort: 5003 | ||
maxDocumentVersion: 20 # 最大版本记录数 | ||
logRetainDays: 3 # 日志保留天数,比如只保留近三天日志 | ||
|
||
# 数据库配置 | ||
db: | ||
mysql: | ||
host: 'mysql-with-think' | ||
username: 'jonnyan404' | ||
password: 'www.mrdoc.fun' | ||
database: 'think' | ||
port: 3306 | ||
charset: 'utf8mb4' | ||
timezone: '+08:00' | ||
synchronize: true | ||
redis: | ||
host: '127.0.0.1' | ||
port: '6379' | ||
password: '' | ||
|
||
# oss 文件存储服务 | ||
oss: | ||
aliyun: | ||
accessKeyId: '' | ||
accessKeySecret: '' | ||
bucket: '' | ||
https: true | ||
region: '' | ||
|
||
# jwt 配置 | ||
jwt: | ||
secretkey: 'zA_Think+KNOWLEDGE+WIKI+DOCUMENTS@2022' | ||
expiresIn: '6h' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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 | ||
else | ||
echo "#####Configuration file already exists#####" | ||
fi | ||
redis-server --daemonize yes | ||
pnpm run pm2 | ||
pm2 logs |