-
Notifications
You must be signed in to change notification settings - Fork 1
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 #13 from nn200433/main
增加docker部署方式
- Loading branch information
Showing
4 changed files
with
89 additions
and
0 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,52 @@ | ||
FROM node:14-alpine3.13 | ||
|
||
# 项目地址(国内加速) | ||
ARG gitUrl="https://ghproxy.com/https://github.com/nn200433/node-metaweblog-api-adaptor.git" | ||
|
||
# 定义环境变量 | ||
ENV TZ=Asia/Shanghai | ||
|
||
# 安装一些常用组件 | ||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \ | ||
apk add -U --no-cache \ | ||
sudo \ | ||
g++ \ | ||
gcc \ | ||
libev-dev \ | ||
libevent-dev \ | ||
libuv-dev \ | ||
make \ | ||
ca-certificates \ | ||
bash \ | ||
curl \ | ||
git \ | ||
openssh \ | ||
openssl-dev \ | ||
alpine-sdk \ | ||
python3 py3-pip \ | ||
tzdata && \ | ||
cp /usr/share/zoneinfo/${TZ} /etc/localtime && \ | ||
echo ${TZ} > /etc/timezone && \ | ||
apk del tzdata && \ | ||
mkdir -p /home | ||
|
||
# 下载项目 | ||
RUN cd /home && \ | ||
git clone --depth=1 "${gitUrl}" metaweblog-api && \ | ||
cd metaweblog-api && chmod +x entrypoint.sh | ||
|
||
# 编译项目 | ||
RUN cd /home/metaweblog-api && \ | ||
npm config set unsafe-perm true && \ | ||
npm config set registry https://registry.npm.taobao.org && \ | ||
yarn config set registry http://registry.npm.taobao.org && \ | ||
npm install -g pnpm && \ | ||
yarn install | ||
|
||
# 指定默认工作目录 | ||
WORKDIR /home/metaweblog-api | ||
|
||
# 默认3000端口 | ||
EXPOSE 3000/tcp | ||
|
||
ENTRYPOINT ["/home/metaweblog-api/entrypoint.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,10 @@ | ||
version: '3' | ||
services: | ||
metaweblog-api: | ||
image: nn200433/metaweblog-api:latest | ||
container_name: metaweblog-api | ||
restart: unless-stopped | ||
ports: | ||
- 6333:3000 | ||
environment: | ||
- TZ=Asia/Shanghai |
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,4 @@ | ||
#!/bin/sh | ||
|
||
# 启动 | ||
exec yarn dev |
00441b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
node-metaweblog-api-adaptor – ./
node-metaweblog-api-adaptor.vercel.app
node-metaweblog-api-adaptor-git-main-terwergreen.vercel.app
node-metaweblog-api-adaptor-terwergreen.vercel.app
xmlrpc.terwergreen.com
api.terwer.space