Skip to content

Commit d2073cc

Browse files
committed
Version 3.0
1 parent 62d6611 commit d2073cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3773
-3123
lines changed

.gitignore

+26-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
119
.DS_Store
2-
bingMapAPIKEY
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
325
.env
4-
node_modules
26+
.vscode/extensions.json
27+
28+
bingMapAPIKEY
529
package-lock.json

.prettierrc

-6
This file was deleted.

Dockerfile

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1-
FROM node:20-alpine
2-
WORKDIR /usr/src/app
1+
# 第一阶段:构建
2+
FROM node:20-alpine as build-stage
3+
WORKDIR /app
34
COPY package*.json ./
45
RUN npm install
56
COPY . .
6-
EXPOSE 8966
7-
CMD ["node", "server.js"]
7+
RUN npm run build
8+
9+
# 第二阶段:运行
10+
# 基于 Node.js 官方镜像
11+
FROM node:20-alpine as production-stage
12+
WORKDIR /app
13+
COPY --from=build-stage /app/node_modules ./node_modules
14+
COPY --from=build-stage /app/package.json ./
15+
COPY --from=build-stage /app/dist ./dist
16+
COPY --from=build-stage /app/server.js ./
17+
COPY --from=build-stage /app/static-server.js ./
18+
COPY --from=build-stage /app/api ./api
19+
20+
EXPOSE 18966
21+
22+
# 启动应用
23+
CMD ["npm", "start"]

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Jason Ng
3+
Copyright (c) 2024 Jason Ng
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
Notes: You can use my demo, but please don't use it for commercial purposes. If you want to use it for commercial purposes, please deploy it yourself.
1313

14-
[![Deploy with Vercel](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/res/img/Vercel.svg)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjason5ng32%2FMyIP&project-name=MyIP&repository-name=MyIP)
15-
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/res/img/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)
14+
[![Deploy with Vercel](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Vercel.svg)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjason5ng32%2FMyIP&project-name=MyIP&repository-name=MyIP)
15+
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)
1616

1717
## 👀 Main Features
1818

@@ -51,13 +51,19 @@ Install:
5151
npm install
5252
```
5353

54+
Build:
55+
56+
```bash
57+
npm run build
58+
```
59+
5460
Run:
5561

5662
```bash
5763
npm start
5864
```
5965

60-
The program will run on port 8966.
66+
The program will run on port 18966.
6167

6268
If you want to add Bing Maps, make the following changes before starting:
6369

@@ -102,13 +108,13 @@ IPINFO_API_TOKEN
102108
Click the 'Deploy to Docker' button at the top to complete the deployment. Or, use the following shell:
103109

104110
```bash
105-
docker run -d -p 8966:8966 --name myip --restart always jason5ng32/myip:latest
111+
docker run -d -p 18966:18966 --name myip --restart always jason5ng32/myip:latest
106112
```
107113

108114
If you wish to display maps, set the Bing Map API Key and allowed domains during deployment:
109115

110116
```bash
111-
docker run -d -p 8966:8966 \
117+
docker run -d -p 18966:18966 \
112118
-e BING_MAP_API_KEY="YOUR_KEY_HERE" \
113119
-e ALLOWED_DOMAINS="example.com" \
114120
--name myip \
@@ -119,7 +125,7 @@ docker run -d -p 8966:8966 \
119125
If you want to use IPInfo.io API, you can also add the following:
120126

121127
```bash
122-
docker run -d -p 8966:8966 \
128+
docker run -d -p 18966:18966 \
123129
-e BING_MAP_API_KEY="YOUR_KEY_HERE" \
124130
-e ALLOWED_DOMAINS="example.com" \
125131
-e IPINFO_API_TOKEN="YOUR_TOKEN_HERE" \

README_CN.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
备注:你可以直接用我已经搭建好的服务,也可以自行搭建。
1313

14-
[![Deploy with Vercel](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/res/img/Vercel.svg)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjason5ng32%2FMyIP&project-name=MyIP&repository-name=MyIP)
15-
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/res/img/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)
14+
[![Deploy with Vercel](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Vercel.svg)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjason5ng32%2FMyIP&project-name=MyIP&repository-name=MyIP)
15+
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)
1616

1717
这是一个完全开源的 IP 信息查看器,可以查询本机 IP、查询任意 IP、查询国内外网站可用性等。这是我第一次用 Vue.js 练手的项目。我……只是一个普通的产品经理。
1818

@@ -53,13 +53,19 @@ git clone https://github.com/jason5ng32/MyIP.git
5353
npm install
5454
```
5555

56+
编译:
57+
58+
```bash
59+
npm run build
60+
```
61+
5662
运行:
5763

5864
```bash
5965
npm start
6066
```
6167

62-
程序会运行在 8966 端口。
68+
程序会运行在 18966 端口。
6369

6470
如果你想添加 Bing 地图,在启动之前,进行如下修改:
6571

@@ -104,13 +110,13 @@ IPINFO_API_TOKEN
104110
点击顶部的部署到 Docker 按钮,即可完成部署,又或者,直接输入下面的命令:
105111

106112
```bash
107-
docker run -d -p 8966:8966 --name myip --restart always jason5ng32/myip:latest
113+
docker run -d -p 18966:18966 --name myip --restart always jason5ng32/myip:latest
108114
```
109115

110116
如果你希望展示地图,则在部署的时候,设置 Bing Map API Key 和允许的域名:
111117

112118
```bash
113-
docker run -d -p 8966:8966 \
119+
docker run -d -p 18966:18966 \
114120
-e BING_MAP_API_KEY="YOUR_KEY_HERE" \
115121
-e ALLOWED_DOMAINS="example.com" \
116122
--name myip \
@@ -121,7 +127,7 @@ docker run -d -p 8966:8966 \
121127
如果你希望同时使用 IPinfo.io 的 API:
122128

123129
```bash
124-
docker run -d -p 8966:8966 \
130+
docker run -d -p 18966:18966 \
125131
-e BING_MAP_API_KEY="YOUR_KEY_HERE" \
126132
-e ALLOWED_DOMAINS="example.com" \
127133
-e IPINFO_API_TOKEN="YOUR_TOKEN_HERE" \

0 commit comments

Comments
 (0)