mirror of
https://github.com/MCSManager/MCSManager.git
synced 2024-11-21 03:12:10 +08:00
Merge pull request #1403 from MCSManager/feature/docker-push
fix: MCSM_INSTANCES_BASE_PATH path err
This commit is contained in:
commit
90bedcd985
@ -361,9 +361,6 @@ export default class Instance extends EventEmitter {
|
||||
}
|
||||
|
||||
absoluteCwdPath() {
|
||||
const envInstancesBasePath = toText(process.env.MCSM_INSTANCES_BASE_PATH);
|
||||
if (envInstancesBasePath)
|
||||
return path.normalize(path.join(envInstancesBasePath, this.instanceUuid));
|
||||
if (!this.config || !this.config.cwd) throw new Error("Instance config error, cwd is Null!");
|
||||
if (path.isAbsolute(this.config.cwd)) return path.normalize(this.config.cwd);
|
||||
return path.normalize(path.join(process.cwd(), this.config.cwd));
|
||||
|
@ -12,6 +12,7 @@ import { EventEmitter } from "stream";
|
||||
import { IInstanceProcess } from "../entity/instance/interface";
|
||||
import { AsyncTask } from "./async_task_service";
|
||||
import iconv from "iconv-lite";
|
||||
import { toText } from "common";
|
||||
|
||||
// Error exception at startup
|
||||
export class StartupDockerProcessError extends Error {
|
||||
@ -116,7 +117,12 @@ export class SetupDockerContainer extends AsyncTask {
|
||||
const isTty = instance.config.terminalOption.pty;
|
||||
|
||||
const workingDir = instance.config.docker.workingDir ?? "";
|
||||
const cwd = instance.absoluteCwdPath();
|
||||
|
||||
let cwd = instance.absoluteCwdPath();
|
||||
const hostRealPath = toText(process.env.MCSM_DOCKER_WORKSPACE_PATH);
|
||||
if (hostRealPath) {
|
||||
cwd = path.normalize(path.join(hostRealPath, instance.instanceUuid));
|
||||
}
|
||||
|
||||
if (workingDir) {
|
||||
instance.println("CONTAINER", $t("TXT_CODE_e76e49e9") + cwd + " --> " + workingDir + "\n");
|
||||
@ -124,7 +130,6 @@ export class SetupDockerContainer extends AsyncTask {
|
||||
instance.println("CONTAINER", $t("TXT_CODE_ffa884f9"));
|
||||
}
|
||||
|
||||
// output startup log
|
||||
logger.info("----------------");
|
||||
logger.info(`[SetupDockerContainer]`);
|
||||
logger.info(`UUID: [${instance.instanceUuid}] [${instance.config.nickname}]`);
|
||||
|
@ -1,28 +0,0 @@
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: dockerfile/web.dockerfile
|
||||
image: ghcr.io/mcsmanager/mcsmanager-web:latest
|
||||
ports:
|
||||
- "80:23333"
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /opt/mcsmanager/data/web/data:/opt/mcsmanager/web/data
|
||||
- /opt/mcsmanager/data/web/logs:/opt/mcsmanager/web/logs
|
||||
|
||||
daemon:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: dockerfile/daemon.dockerfile
|
||||
image: ghcr.io/mcsmanager/mcsmanager-daemon:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "24444:24444"
|
||||
environment:
|
||||
- MCSM_INSTANCES_BASE_PATH=/opt/mcsmanager/daemon/data/InstanceData
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /opt/mcsmanager/data/daemon/data:/opt/mcsmanager/daemon/data
|
||||
- /opt/mcsmanager/data/daemon/logs:/opt/mcsmanager/daemon/logs
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
23
example.docker-compose.yml
Normal file
23
example.docker-compose.yml
Normal file
@ -0,0 +1,23 @@
|
||||
# docker-compose.yml
|
||||
services:
|
||||
web:
|
||||
image: githubyumao/mcsmanager-web:latest
|
||||
ports:
|
||||
- "23333:23333"
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- <CHANGE_ME_TO_INSTALL_PATH>/web/data:/opt/mcsmanager/web/data
|
||||
- <CHANGE_ME_TO_INSTALL_PATH>/web/logs:/opt/mcsmanager/web/logs
|
||||
|
||||
daemon:
|
||||
image: githubyumao/mcsmanager-daemon:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "24444:24444"
|
||||
environment:
|
||||
- MCSM_DOCKER_WORKSPACE_PATH=<CHANGE_ME_TO_INSTALL_PATH>/daemon/data/InstanceData
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- <CHANGE_ME_TO_INSTALL_PATH>/daemon/data:/opt/mcsmanager/daemon/data
|
||||
- <CHANGE_ME_TO_INSTALL_PATH>/daemon/logs:/opt/mcsmanager/daemon/logs
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
@ -1779,7 +1779,7 @@
|
||||
"TXT_CODE_db37b7f9": "映像下載錯誤,請確保此映像名正確,或在節點管理的控制台處手動透過 docker pull 拉取您需要的映像,錯誤訊息:",
|
||||
"TXT_CODE_1cf6fc4b": "此容器的開放端口配置有誤!",
|
||||
"TXT_CODE_2029027e": "此容器的開放端口配置有誤,分隔符號左右兩邊不存在值!",
|
||||
"TXT_CODE_e76e49e9": "已掛載工作目錄:",
|
||||
"TXT_CODE_e76e49e9": "已載入工作目錄:",
|
||||
"TXT_CODE_90a9d317": "容器環境變數",
|
||||
"TXT_CODE_a42984e": "變數名稱",
|
||||
"TXT_CODE_115e8a25": "變數值",
|
||||
|
Loading…
Reference in New Issue
Block a user