Skip to content

Commit

Permalink
Merge pull request #94 from hq002/docker
Browse files Browse the repository at this point in the history
Docker
  • Loading branch information
Linkontoask committed May 25, 2024
2 parents 5a26fe4 + ef735bb commit f13e35e
Show file tree
Hide file tree
Showing 8 changed files with 555 additions and 675 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
*.log
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "radishes-v2"]
path = packages/api
url = git@github.com:radishes-music/NeteaseCloudMusicApi.git
url = https://github.com/radishes-music/NeteaseCloudMusicApi.git
branch = radishes
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 阶段一: 构建
FROM node:18 AS build
WORKDIR /app
COPY . .
RUN YARN_IGNORE_SCRIPTS=1 yarn
RUN yarn build:web

# 阶段二: 设置 Nginx
FROM nginx:latest
# 注意:你可能需要根据你的 Nginx 配置和构建的输出修改以下这行
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ yarn pkg:macos
##### linux 端
```
yarn pkg:linux
```
```

### 一键部署

```
docker-compose up -d
# 然后访问 http://localhost:1234
```

### 支持的功能

Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:

nginx:
build: # 这是你的 Nginx Dockerfile 所在的位置
context: .
dockerfile: Dockerfile
depends_on:
- node
ports:
- "1234:80"

node:
build: ./packages/api
ports:
- "32768:32768"
16 changes: 16 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ =404;
}

location /api/ {
proxy_pass http://node:32768/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
"pkg:macos": "yarn build:electron && yarn workspace @radishes/api run buildmacos && npx electron-builder --config .electron-builder.config.js -m",
"test": "lerna run test --stream",
"test:unit": "vue-cli-service test:unit",
"test:open": "cypress open",
"test:run": "cypress run",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx",
"lint:fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx --fix",
"lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,json,tsx,css,less}\"",
Expand Down Expand Up @@ -78,7 +76,7 @@
"typescript": "^5.2.2",
"uuid": "^8.3.2",
"v-easy-components": "2.0.0",
"vant": "^3.0.6",
"vant": "^3.6.12",
"vue": "^3.3.7",
"vue-i18n": "^9.1.7",
"vue-router": "^4.2.5",
Expand Down Expand Up @@ -119,7 +117,6 @@
"conventional-changelog-cli": "^2.1.1",
"cross-env": "^7.0.2",
"cross-spawn": "^7.0.3",
"cypress": "^6.2.0",
"electron": "^27.1.0",
"electron-builder": "^24.6.4",
"electron-devtools-installer": "^3.2.0",
Expand Down
Loading

0 comments on commit f13e35e

Please sign in to comment.