Skip to content

Commit 5a6f2eb

Browse files
update docker version to architecture layering
1 parent 2cc7b6a commit 5a6f2eb

File tree

12 files changed

+89
-47
lines changed

12 files changed

+89
-47
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ NSMusicS-Electron/resources/mpv-0.39.0
4040
NSMusicS-Electron/src_example
4141
NSMusicS-Electron/yarn.lock
4242

43-
NSMusicS-Go/tmp/main.exe
43+
NSMusicS-Go/tmp/main.exe
44+
45+
NSMusicS-Web

NSMusicS-Electron/.env

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1-
APP_ADDRESS=:5173
2-
APP_PORT=5173
1+
APP_ENV=development
2+
SERVER_PORT=8089
3+
APP_PORT=5173
4+
CONTEXT_TIMEOUT=2
5+
DB_HOST=mongodb
6+
DB_PORT=27017
7+
DB_USER=your_username
8+
DB_PASS=your_password
9+
DB_NAME=nsmusics-go-db
10+
ACCESS_TOKEN_EXPIRY_HOUR=2
11+
REFRESH_TOKEN_EXPIRY_HOUR=168
12+
ACCESS_TOKEN_SECRET=access_token_secret
13+
REFRESH_TOKEN_SECRET=refresh_token_secret

NSMusicS-Electron/Dockerfile

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
FROM node:20.15.0-alpine
22
WORKDIR /app
3-
RUN npm install -g serve
3+
RUN npm install -g serve --production --no-cache
44
COPY dist/ /app
55
EXPOSE $APP_PORT
6-
CMD ["sh", "-c", "serve -s -l ${APP_PORT}"]
6+
CMD ["sh", "-c", "serve -s -l ${APP_PORT}"]
7+
8+
# NSMusicS-NodeServer
9+
# FROM node:20.15.0-alpine
10+
# WORKDIR /app
11+
# RUN npm install -g serve
12+
# COPY dist/ /app
13+
# COPY server.js /app
14+
# COPY nodemon.json /app
15+
# COPY package.json /app
16+
# EXPOSE $APP_PORT
17+
# RUN npm install -g nodemon --production --no-cache
18+
# RUN npm install koa koa-router @koa/cors koa-bodyparser mongodb --production --no-cache
19+
# CMD ["sh", "-c", "serve -s -l ${APP_PORT} & nodemon server.js"]

NSMusicS-Electron/package.json

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
"email": "[email protected]"
88
},
99
"description": "NSMusicS For Web(Electron+Vue3+TS),Multi platform Multi mode Super Music Software (Full stack development, audio processing, artificial intelligence, natural language processing)",
10-
"version": "1.4.1",
10+
"version": "1.4.2",
1111
"private": true,
1212
"license": "AGPL - 3.0",
1313
"scripts": {
1414
"dev": "vite",
15-
"preview": "vite preview",
1615
"build": "vite build",
17-
"clean": "rm -rf node_modules/.cache dist",
18-
"type-check": "vue-tsc --build --force"
16+
"preview": "vite preview",
17+
"server": "nodemon server.js"
1918
},
2019
"dependencies": {
2120
"@lottiefiles/lottie-player": "^2.0.4",
@@ -48,7 +47,12 @@
4847
"vue-draggable-plus": "^0.5.3",
4948
"vue-i18n": "next",
5049
"vue-rate": "next",
51-
"vue-virtual-scroller": "next"
50+
"vue-virtual-scroller": "next",
51+
"@koa/cors": "^3.3.0",
52+
"koa": "^2.13.4",
53+
"koa-bodyparser": "^4.3.0",
54+
"koa-router": "^12.0.0",
55+
"mongodb": "^4.9.0"
5256
},
5357
"devDependencies": {
5458
"@tsconfig/node18": "^18.2.2",

NSMusicS-Electron/resources/config/NSMusicS.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<item>
3-
<version>1.4.1</version>
3+
<version>1.4.2</version>
44
<url> </url>
55
<changelog>https://github.com/Super-Badmen-Viper/NSMusicS/releases</changelog>
66
<changelog_explain>
7-
1.4.1已更新内容;
7+
1.4.2已更新内容;
88
增加迷你播放窗口,竖向模式为仿制AppleMusic迷你播放悬浮窗,横向模式为桌面歌词[进行中];
99
增加服务器配置种类,兼容emby-api[√];
1010
增加服务器配置种类,兼容jellyfin-api[√];

NSMusicS-Electron/src/App.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@
729729
inheritLocale: true,
730730
useScope: 'global'
731731
})
732+
import axios from "axios";
732733
onMounted(async () => {
733734
if(isElectron) {
734735
store_app_configs_info.navidrome_db = await ipcRenderer.invoke('window-get-navidrome-db');
@@ -780,7 +781,7 @@
780781
}
781782
782783
try {
783-
store_app_configs_info.version = '1.4.1';
784+
store_app_configs_info.version = '1.4.2';
784785
console.log('Current Version:', store_app_configs_info.version);
785786
const xmlUrl = 'https://github.com/Super-Badmen-Viper/NSMusicS/releases/download/NSMusicS-Win-Update/NSMusicS.xml';
786787
await store_app_configs_logic_update.fetchAndParseXML(xmlUrl);
@@ -793,6 +794,8 @@
793794
}catch {
794795
store_app_configs_info.version_updated = 0;
795796
}
797+
const data = await axios('http://localhost:27017/');
798+
console.log(data);
796799
});
797800
</script>
798801
<template>

NSMusicS-Electron/src/background.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ else {
7474

7575
await initModifyMediaTag();
7676

77-
context_MainWin.mainWindow.once('ready-to-show', () => {
78-
context_MainWin.mainWindow.webContents.setZoomFactor(1);
79-
context_MainWin.mainWindow.show()
80-
})
77+
context_MainWin.mainWindow.webContents.setZoomFactor(1);
78+
context_MainWin.mainWindow.show()
8179

8280
setTimeout(clearSessionClearCache, 5000);
8381
});

NSMusicS-Electron/src/data/data_access/servers_configs/jellyfin_api/services_web/Jellyfin_Api_Services_Web.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class Jellyfin_Api_Services_Web {
2626
if(store_server_user_model.authorization_of_Je != undefined &&
2727
store_server_user_model.authorization_of_Je.length > 0) {
2828
const headers = {
29-
'Authorization': `MediaBrowser Token="${store_server_user_model.authorization_of_Je}", Client="Electron Desktop", Device="NSMusicS", DeviceId="NSMusicS-GO", Version="1.4.1"`
29+
'Authorization': `MediaBrowser Token="${store_server_user_model.authorization_of_Je}", Client="Electron Desktop", Device="NSMusicS", DeviceId="NSMusicS-GO", Version="1.4.2"`
3030
};
3131

3232
const queryString = params ? new URLSearchParams(params).toString() : '';

NSMusicS-Electron/src/data/data_access/servers_configs/jellyfin_api/services_web/Users/index_service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class Users_ApiService_of_Je extends Jellyfin_Api_Services_Web {
2424
const url = `${baseUrl}/${endpoint}`;
2525
const AccessToken = '27ec731cc56344159d05822f13bfef75';
2626
const headers = {
27-
'Authorization': `MediaBrowser Token="${AccessToken}", Client="Electron Desktop", Device="NSMusicS", DeviceId="NSMusicS-GO", Version="1.4.1"`
27+
'Authorization': `MediaBrowser Token="${AccessToken}", Client="Electron Desktop", Device="NSMusicS", DeviceId="NSMusicS-GO", Version="1.4.2"`
2828
};
2929
const data = {
3030
Username: username,

NSMusicS-Electron/vite.config.ts

+2-20
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,8 @@ export default defineConfig({
3737
base:'./', //默认绝对路径改为相对路径 否则打包白屏
3838
resolve: {
3939
alias: {
40-
'@': fileURLToPath(new URL('./src', import.meta.url)),
41-
// os: 'os-browserify/browser',
42-
// path: 'path-browserify',
40+
'@': fileURLToPath(new URL('./src', import.meta.url))
4341
}
44-
},
45-
// build: {
46-
// outDir: 'dist',
47-
// assetsDir: 'static',
48-
// rollupOptions: {
49-
// external: ['os', 'path'],
50-
// input: 'src/main.ts',
51-
// output: {
52-
// format: 'iife',
53-
// name: 'NSMusicS',
54-
// },
55-
// },
56-
// },
57-
// server: {
58-
// host: '0.0.0.0', // 允许外部访问
59-
// port: 5173, // 确保端口与 Docker 映射一致
60-
// },
42+
}
6143
})
6244

NSMusicS-GO/.env

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1+
# 应用配置
12
APP_ENV=development
23
SERVER_ADDRESS=:8089
34
PORT=8089
4-
CONTEXT_TIMEOUT=2
5-
DB_HOST=localhost #localhost: local #mongodb: docker
5+
APP_PORT=5173
6+
CONTEXT_TIMEOUT=10 # 增加超时时间
7+
8+
# MongoDB 配置
9+
DB_HOST=mongodb # 必须使用服务名称
610
DB_PORT=27017
711
DB_USER=jiuge01
812
DB_PASS=jiuge01
913
DB_NAME=nsmusics-go-db
10-
ACCESS_TOKEN_EXPIRY_HOUR = 2
11-
REFRESH_TOKEN_EXPIRY_HOUR = 168
14+
15+
# Token 配置
16+
ACCESS_TOKEN_EXPIRY_HOUR=2
17+
REFRESH_TOKEN_EXPIRY_HOUR=168
1218
ACCESS_TOKEN_SECRET=access_token_secret
1319
REFRESH_TOKEN_SECRET=refresh_token_secret

NSMusicS-GO/Dockerfile

+27-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,42 @@
1-
# Build Normal Model
1+
# Build -GO Model
22
# FROM golang:1.24.0-alpine
33
# RUN mkdir /app
44
# ADD . /app
55
# WORKDIR /app
66
# RUN go build -o main cmd/main.go
77
# CMD ["/app/main"]
88

9-
# Build Simplify Model
9+
# Build Simplify-GO Model
1010
FROM golang:1.24.0-alpine AS builder
1111
WORKDIR /app
1212
ADD . /app
1313
RUN go mod download
14-
RUN CGO_ENABLED=0 go build -o main cmd/main.go
14+
RUN go build -o main cmd/main.go
1515
FROM alpine:latest
1616
WORKDIR /app
1717
COPY --from=builder /app/main /app/main
1818
COPY --from=builder /app/.env /app/.env
19-
CMD ["/app/main"]
19+
CMD ["/app/main"]
20+
21+
# Build Vue-GO Model
22+
# FROM golang:1.24.0-alpine AS go-builder
23+
# WORKDIR /app
24+
# COPY . .
25+
# RUN go mod download && \
26+
# go build -o main cmd/main.go
27+
# FROM node:20.15.0-alpine
28+
# WORKDIR /app
29+
# COPY --from=go-builder /app/main /app/main
30+
# COPY --from=go-builder /app/.env /app/.env
31+
# RUN npm install -g serve
32+
# COPY dist/ /app/dist
33+
34+
# RUN echo $'#!/bin/sh\n\
35+
# /app/main &\n\
36+
# serve -s -l ${APP_PORT:-5173} /app/dist\n\
37+
# ' > /app/start.sh && \
38+
# chmod +x /app/start.sh
39+
40+
# EXPOSE 8089 5173 27017
41+
42+
# CMD ["/app/start.sh"]

0 commit comments

Comments
 (0)