Skip to content

Commit

Permalink
chore: 支持 Docker Compose 部署
Browse files Browse the repository at this point in the history
  • Loading branch information
llovvoll committed Jan 7, 2022
1 parent 07b5d4d commit bfa834d
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
node_modules
npm-debug.log
Dockerfile*
docker-compose*
.dockerignore
.git
.github
.gitignore
README.md
LICENSE
.vscode
dist
dist_electron
build
images
netease_api
script
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:lts-alpine as build
WORKDIR /app
COPY . .
RUN mv .env.example .env \
&& yarn \
&& yarn build

FROM nginx:alpine as a
COPY --from=build /app/dist /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ yarn run build

7.`/dist` 目录下的文件上传到你的 Web 服务器

## ⚙️ Docker Compose 部署

```sh
git clone https:/qier222/YesPlayMusic.git

docker-compose up -d
```

YesPlayMusic 地址为 `http://localhost`

## 👷‍♂️ 打包客户端

如果在 Release 页面没有找到适合你的设备的安装包的话,你可以根据下面的步骤来打包自己的客户端。
Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
api:
build: ./netease_api
image: neteaseapi
container_name: NeteaseApi
restart: always

app:
build: ./
image: yesplaymusic
container_name: YesPlayMusic
volumes:
- ./docker/nginx/conf.d:/etc/nginx/conf.d
ports:
- 80:80
restart: always
25 changes: 25 additions & 0 deletions docker/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
server {
gzip on;
listen 80;
listen [::]:80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}

location @rewrites {
rewrite ^(.*)$ /index.html last;
}

location /api/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $remote_addr;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://api:3000/;
}
}

0 comments on commit bfa834d

Please sign in to comment.