Skip to content

Commit b52a707

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 3794083 + 00441b8 commit b52a707

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

Dockerfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
FROM node:14-alpine3.13
2+
3+
# 项目地址(国内加速)
4+
ARG gitUrl="https://ghproxy.com/https://github.com/nn200433/node-metaweblog-api-adaptor.git"
5+
6+
# 定义环境变量
7+
ENV TZ=Asia/Shanghai
8+
9+
# 安装一些常用组件
10+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
11+
apk add -U --no-cache \
12+
sudo \
13+
g++ \
14+
gcc \
15+
libev-dev \
16+
libevent-dev \
17+
libuv-dev \
18+
make \
19+
ca-certificates \
20+
bash \
21+
curl \
22+
git \
23+
openssh \
24+
openssl-dev \
25+
alpine-sdk \
26+
python3 py3-pip \
27+
tzdata && \
28+
cp /usr/share/zoneinfo/${TZ} /etc/localtime && \
29+
echo ${TZ} > /etc/timezone && \
30+
apk del tzdata && \
31+
mkdir -p /home
32+
33+
# 下载项目
34+
RUN cd /home && \
35+
git clone --depth=1 "${gitUrl}" metaweblog-api && \
36+
cd metaweblog-api && chmod +x entrypoint.sh
37+
38+
# 编译项目
39+
RUN cd /home/metaweblog-api && \
40+
npm config set unsafe-perm true && \
41+
npm config set registry https://registry.npm.taobao.org && \
42+
yarn config set registry http://registry.npm.taobao.org && \
43+
npm install -g pnpm && \
44+
yarn install
45+
46+
# 指定默认工作目录
47+
WORKDIR /home/metaweblog-api
48+
49+
# 默认3000端口
50+
EXPOSE 3000/tcp
51+
52+
ENTRYPOINT ["/home/metaweblog-api/entrypoint.sh"]

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,29 @@ The `pages/api` directory is mapped to `/api/*`. Files in this directory are tre
4848

4949
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
5050

51+
## Docker
52+
53+
docker:
54+
55+
```bash
56+
docker run -itd --name=metaweblog-api -p 6333:3000 -e TZ=Asia/Shanghai --restart=unless-stopped nn200433/metaweblog-api:latest
57+
```
58+
59+
docker-compose:
60+
61+
```yaml
62+
version: '3'
63+
services:
64+
metaweblog-api:
65+
image: nn200433/metaweblog-api:latest
66+
container_name: metaweblog-api
67+
restart: unless-stopped
68+
ports:
69+
- 6333:3000
70+
environment:
71+
- TZ=Asia/Shanghai
72+
```
73+
5174
## Learn More
5275
5376
To learn more about Next.js, take a look at the following resources:

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '3'
2+
services:
3+
metaweblog-api:
4+
image: nn200433/metaweblog-api:latest
5+
container_name: metaweblog-api
6+
restart: unless-stopped
7+
ports:
8+
- 6333:3000
9+
environment:
10+
- TZ=Asia/Shanghai

entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
# 启动
4+
exec yarn dev

0 commit comments

Comments
 (0)