This commit is contained in:
Louis Lam 2023-11-10 18:16:52 +08:00
parent eb6db8b31e
commit a12c6dc033
10 changed files with 69 additions and 1005 deletions

View file

@ -3,6 +3,7 @@
node_modules
.idea
data
stacks
tmp
/private
@ -11,5 +12,6 @@ docker
frontend
.editorconfig
.eslintrc.cjs
.git
.gitignore
README.md

6
.gitignore vendored
View file

@ -1,10 +1,12 @@
# Should update .dockerignore as well
.env
node_modules
dist
frontend-dist
.idea
data
stacks
tmp
/private
# Git only
frontend-dist

View file

@ -81,6 +81,14 @@ export class DockgeServer {
// Log NODE ENV
log.info("server", "NODE_ENV: " + process.env.NODE_ENV);
// Default stacks directory
let defaultStacksDir;
if (process.platform === "win32") {
defaultStacksDir = "./stacks";
} else {
defaultStacksDir = "/opt/stacks";
}
// Define all possible arguments
let args = parse<Arguments>({
sslKey: {
@ -106,6 +114,10 @@ export class DockgeServer {
dataDir: {
type: String,
optional: true,
},
stacksDir: {
type: String,
optional: true,
}
});
@ -118,6 +130,8 @@ export class DockgeServer {
this.config.port = args.port || parseInt(process.env.DOCKGE_PORT) || 5001;
this.config.hostname = args.hostname || process.env.DOCKGE_HOSTNAME || undefined;
this.config.dataDir = args.dataDir || process.env.DOCKGE_DATA_DIR || "./data/";
this.config.stacksDir = args.stacksDir || process.env.DOCKGE_STACKS_DIR || defaultStacksDir;
this.stacksDir = this.config.stacksDir;
log.debug("server", this.config);
@ -406,7 +420,6 @@ export class DockgeServer {
}
// Create data/stacks directory
this.stacksDir = path.join(this.config.dataDir, "stacks");
if (!fs.existsSync(this.stacksDir)) {
fs.mkdirSync(this.stacksDir, { recursive: true });
}

View file

@ -64,11 +64,7 @@ export class Stack {
}
get isManagedByDockge() : boolean {
if (this._configFilePath) {
return this._configFilePath.startsWith(this.server.stackDirFullPath) && fs.existsSync(this.path) && fs.statSync(this.path).isDirectory();
} else {
return false;
}
return fs.existsSync(this.path) && fs.statSync(this.path).isDirectory();
}
get status() : number {

View file

@ -19,11 +19,13 @@ export interface Arguments {
port? : number;
hostname? : string;
dataDir? : string;
stacksDir? : string;
}
// Some config values are required
export interface Config extends Arguments {
dataDir : string;
stacksDir : string;
}
export function checkLogin(socket : DockgeSocket) {

View file

@ -1,4 +1,3 @@
# docker run -d --name dockge -p 5001:5001 -v dockge:/app/data -v /var/run/docker.sock:/var/run/docker.sock --restart=always louislam/dockge:nightly
version: "3.8"
services:
dockge:
@ -6,5 +5,8 @@ services:
ports:
- 5001:5001
volumes:
- ./data:/app/data
- /var/run/docker.sock:/var/run/docker.sock
- ./data:/app/data
- /opt/stacks:/opt/stacks
environment:
- DOCKGE_STACKS_DIR=/opt/stacks

View file

@ -1,11 +1,20 @@
############################################
# Build
############################################
FROM louislam/dockge:base AS build
WORKDIR /app
COPY --chown=node:node ./package.json ./package.json
COPY --chown=node:node ./pnpm-lock.yaml ./pnpm-lock.yaml
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
############################################
# ⭐ Main Image
############################################
FROM louislam/dockge:base AS release
WORKDIR /app
COPY --chown=node:node . .
RUN pnpm install --prod --frozen-lockfile && \
mkdir ./data
COPY --from=build /app/node_modules /app/node_modules
RUN mkdir ./data
VOLUME /app/data
EXPOSE 5001

View file

@ -194,7 +194,7 @@ const template = `version: "3.8"
services:
nginx:
image: nginx:latest
restart: always
restart: unless-stopped
ports:
- "8080:80"
`;
@ -538,7 +538,7 @@ export default {
}
this.jsonConfig.services[this.newContainerName] = {
restart: "always",
restart: "unless-stopped",
};
this.newContainerName = "";
let element = this.$refs.containerList.lastElementChild;

View file

@ -42,15 +42,12 @@
"type-fest": "~4.3.3",
"yaml": "~2.3.4"
},
"optionalDependencies": {
"pm2": "~5.3.0"
},
"devDependencies": {
"@fortawesome/fontawesome-svg-core": "6.4.2",
"@fortawesome/free-regular-svg-icons": "6.4.2",
"@fortawesome/free-solid-svg-icons": "6.4.2",
"@fortawesome/vue-fontawesome": "3.0.3",
"@types/bootstrap": "^5.2.8",
"@types/bootstrap": "~5.2.8",
"@types/command-exists": "~1.2.3",
"@types/express": "~4.17.21",
"@types/jsonwebtoken": "~9.0.4",
@ -63,19 +60,17 @@
"eslint": "~8.50.0",
"eslint-plugin-jsdoc": "~46.8.2",
"eslint-plugin-vue": "~9.17.0",
"monaco-editor": "^0.44.0",
"monaco-yaml": "^5.1.0",
"prismjs": "~1.29.0",
"sass": "~1.68.0",
"typescript": "~5.2.2",
"unplugin-vue-components": "^0.25.2",
"unplugin-vue-components": "~0.25.2",
"vite": "~4.5.0",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-compression": "~0.5.1",
"vue": "~3.3.8",
"vue-eslint-parser": "^9.3.2",
"vue-eslint-parser": "~9.3.2",
"vue-i18n": "~9.5.0",
"vue-prism-editor": "2.0.0-alpha.2",
"vue-qrcode": "^2.2.0",
"vue-qrcode": "~2.2.0",
"vue-router": "~4.2.5",
"vue-toastification": "2.0.0-rc.5",
"xterm": "~5.3.0",

File diff suppressed because it is too large Load diff