Skip to content

Commit

Permalink
Version 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jason5ng32 committed Jan 27, 2024
1 parent 62d6611 commit d2073cc
Show file tree
Hide file tree
Showing 59 changed files with 3,773 additions and 3,123 deletions.
28 changes: 26 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
bingMapAPIKEY
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.env
node_modules
.vscode/extensions.json

bingMapAPIKEY
package-lock.json
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

24 changes: 20 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
FROM node:20-alpine
WORKDIR /usr/src/app
# 第一阶段:构建
FROM node:20-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8966
CMD ["node", "server.js"]
RUN npm run build

# 第二阶段:运行
# 基于 Node.js 官方镜像
FROM node:20-alpine as production-stage
WORKDIR /app
COPY --from=build-stage /app/node_modules ./node_modules
COPY --from=build-stage /app/package.json ./
COPY --from=build-stage /app/dist ./dist
COPY --from=build-stage /app/server.js ./
COPY --from=build-stage /app/static-server.js ./
COPY --from=build-stage /app/api ./api

EXPOSE 18966

# 启动应用
CMD ["npm", "start"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Jason Ng
Copyright (c) 2024 Jason Ng

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

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.

[![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)
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/res/img/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)
[![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)
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)

## 👀 Main Features

Expand Down Expand Up @@ -51,13 +51,19 @@ Install:
npm install
```

Build:

```bash
npm run build
```

Run:

```bash
npm start
```

The program will run on port 8966.
The program will run on port 18966.

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

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

```bash
docker run -d -p 8966:8966 --name myip --restart always jason5ng32/myip:latest
docker run -d -p 18966:18966 --name myip --restart always jason5ng32/myip:latest
```

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

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

```bash
docker run -d -p 8966:8966 \
docker run -d -p 18966:18966 \
-e BING_MAP_API_KEY="YOUR_KEY_HERE" \
-e ALLOWED_DOMAINS="example.com" \
-e IPINFO_API_TOKEN="YOUR_TOKEN_HERE" \
Expand Down
18 changes: 12 additions & 6 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

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

[![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)
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/res/img/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)
[![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)
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)

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

Expand Down Expand Up @@ -53,13 +53,19 @@ git clone https://github.com/jason5ng32/MyIP.git
npm install
```

编译:

```bash
npm run build
```

运行:

```bash
npm start
```

程序会运行在 8966 端口。
程序会运行在 18966 端口。

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

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

```bash
docker run -d -p 8966:8966 --name myip --restart always jason5ng32/myip:latest
docker run -d -p 18966:18966 --name myip --restart always jason5ng32/myip:latest
```

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

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

```bash
docker run -d -p 8966:8966 \
docker run -d -p 18966:18966 \
-e BING_MAP_API_KEY="YOUR_KEY_HERE" \
-e ALLOWED_DOMAINS="example.com" \
-e IPINFO_API_TOKEN="YOUR_TOKEN_HERE" \
Expand Down
Loading

0 comments on commit d2073cc

Please sign in to comment.