@wocker/ws 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +11 -137
  2. package/bin/ws.js +7 -3
  3. package/lib/App.d.ts +10 -7
  4. package/lib/App.js +99 -44
  5. package/lib/controllers/ImageController.d.ts +4 -2
  6. package/lib/controllers/ImageController.js +27 -25
  7. package/lib/controllers/PluginController.d.ts +14 -0
  8. package/lib/controllers/PluginController.js +84 -0
  9. package/lib/controllers/PresetController.d.ts +21 -0
  10. package/lib/controllers/PresetController.js +169 -0
  11. package/lib/controllers/ProjectController.d.ts +11 -3
  12. package/lib/controllers/ProjectController.js +653 -536
  13. package/lib/{plugins/ProxyPlugin.d.ts → controllers/ProxyController.d.ts} +12 -11
  14. package/lib/controllers/ProxyController.js +273 -0
  15. package/lib/controllers/index.d.ts +3 -0
  16. package/lib/controllers/index.js +19 -25
  17. package/lib/env.js +33 -22
  18. package/lib/index.d.ts +2 -0
  19. package/lib/index.js +29 -28
  20. package/lib/makes/Controller.js +4 -8
  21. package/lib/makes/DI.d.ts +7 -0
  22. package/lib/makes/DI.js +27 -0
  23. package/lib/makes/Docker.js +299 -397
  24. package/lib/makes/FS.d.ts +1 -1
  25. package/lib/makes/FS.js +328 -301
  26. package/lib/makes/LineConvertStream.js +37 -40
  27. package/lib/makes/Logger.d.ts +5 -3
  28. package/lib/makes/Logger.js +18 -34
  29. package/lib/makes/Model.js +8 -12
  30. package/lib/makes/MySQL.js +6 -27
  31. package/lib/makes/Plugin.d.ts +1 -1
  32. package/lib/makes/Plugin.js +55 -37
  33. package/lib/makes/Preset.d.ts +46 -0
  34. package/lib/makes/Preset.js +33 -0
  35. package/lib/{models → makes}/Project.d.ts +23 -16
  36. package/lib/makes/Project.js +127 -0
  37. package/lib/makes/Repository.js +18 -21
  38. package/lib/makes/index.d.ts +3 -0
  39. package/lib/makes/index.js +23 -69
  40. package/lib/plugins/ElasticSearchPlugin.d.ts +18 -0
  41. package/lib/plugins/ElasticSearchPlugin.js +72 -0
  42. package/lib/plugins/LocaltunnelPlugin.d.ts +4 -4
  43. package/lib/plugins/LocaltunnelPlugin.js +256 -255
  44. package/lib/plugins/MaildevPlugin.d.ts +4 -2
  45. package/lib/plugins/MaildevPlugin.js +45 -41
  46. package/lib/plugins/MongodbPlugin.d.ts +6 -4
  47. package/lib/plugins/MongodbPlugin.js +303 -254
  48. package/lib/plugins/NgrokPlugin.d.ts +3 -4
  49. package/lib/plugins/NgrokPlugin.js +221 -230
  50. package/lib/plugins/PageKitePlugin.d.ts +3 -4
  51. package/lib/plugins/PageKitePlugin.js +150 -147
  52. package/lib/plugins/PostgresPlugin.d.ts +1 -1
  53. package/lib/plugins/PostgresPlugin.js +115 -88
  54. package/lib/plugins/ProxmoxPlugin.d.ts +1 -1
  55. package/lib/plugins/ProxmoxPlugin.js +50 -38
  56. package/lib/plugins/RedisPlugin.d.ts +10 -2
  57. package/lib/plugins/RedisPlugin.js +77 -39
  58. package/lib/plugins/index.d.ts +2 -6
  59. package/lib/plugins/index.js +25 -158
  60. package/lib/services/AppConfigService.d.ts +13 -3
  61. package/lib/services/AppConfigService.js +161 -71
  62. package/lib/services/AppEventsService.d.ts +5 -8
  63. package/lib/services/AppEventsService.js +26 -25
  64. package/lib/services/DockerService.d.ts +51 -0
  65. package/lib/services/DockerService.js +200 -0
  66. package/lib/services/LogService.d.ts +12 -0
  67. package/lib/services/LogService.js +38 -0
  68. package/lib/services/PluginService.d.ts +11 -0
  69. package/lib/services/PluginService.js +15 -0
  70. package/lib/services/PresetService.d.ts +14 -0
  71. package/lib/services/PresetService.js +64 -0
  72. package/lib/services/ProjectService.d.ts +12 -4
  73. package/lib/services/ProjectService.js +141 -78
  74. package/lib/services/index.d.ts +4 -0
  75. package/lib/services/index.js +21 -36
  76. package/lib/types/Config.d.ts +4 -3
  77. package/lib/types/Config.js +1 -4
  78. package/lib/types/EnvConfig.js +1 -4
  79. package/lib/types/index.js +16 -25
  80. package/lib/utils/buildOptions.js +5 -8
  81. package/lib/utils/demuxOutput.js +16 -22
  82. package/lib/utils/escapeRegExp.js +4 -7
  83. package/lib/utils/exec.d.ts +1 -1
  84. package/lib/utils/exec.js +38 -40
  85. package/lib/utils/fetch.js +45 -30
  86. package/lib/utils/followProgress.js +66 -77
  87. package/lib/utils/format-size-units.js +16 -16
  88. package/lib/utils/get-config.d.ts +1 -1
  89. package/lib/utils/get-config.js +13 -16
  90. package/lib/utils/get-cursor-position.js +22 -29
  91. package/lib/utils/image-build.js +35 -23
  92. package/lib/utils/index.d.ts +0 -4
  93. package/lib/utils/index.js +32 -235
  94. package/lib/utils/injectVariables.js +10 -13
  95. package/lib/utils/parse-table.js +20 -23
  96. package/lib/utils/set-config.d.ts +1 -1
  97. package/lib/utils/set-config.js +12 -15
  98. package/lib/utils/spawn.js +17 -20
  99. package/lib/utils/tty.js +2 -6
  100. package/lib/utils/volumeFormat.js +5 -12
  101. package/lib/utils/volumeParse.js +10 -13
  102. package/package.json +21 -47
  103. package/presets/bun/Dockerfile +11 -0
  104. package/presets/bun/config.json +3 -0
  105. package/presets/node/Dockerfile +4 -2
  106. package/presets/node/config.json +9 -7
  107. package/presets/php-apache/Dockerfile +40 -38
  108. package/presets/php-apache/config.json +10 -15
  109. package/presets/php-fpm/Dockerfile +21 -0
  110. package/presets/php-fpm/config.json +25 -0
  111. package/lib/models/Preset.d.ts +0 -19
  112. package/lib/models/Preset.js +0 -60
  113. package/lib/models/Project.js +0 -151
  114. package/lib/models/index.d.ts +0 -2
  115. package/lib/models/index.js +0 -27
  116. package/lib/plugins/MariadbPlugin.d.ts +0 -25
  117. package/lib/plugins/MariadbPlugin.js +0 -297
  118. package/lib/plugins/PresetPlugin.d.ts +0 -19
  119. package/lib/plugins/PresetPlugin.js +0 -164
  120. package/lib/plugins/ProjectPlugin.d.ts +0 -12
  121. package/lib/plugins/ProjectPlugin.js +0 -54
  122. package/lib/plugins/ProxyPlugin.js +0 -257
  123. package/lib/plugins/ServeoPlugin.d.ts +0 -36
  124. package/lib/plugins/ServeoPlugin.js +0 -260
  125. package/lib/plugins/TestPlugin.d.ts +0 -10
  126. package/lib/plugins/TestPlugin.js +0 -75
  127. package/lib/utils/promptConfirm.d.ts +0 -6
  128. package/lib/utils/promptConfirm.js +0 -21
  129. package/lib/utils/promptGroup.d.ts +0 -16
  130. package/lib/utils/promptGroup.js +0 -39
  131. package/lib/utils/promptSelect.d.ts +0 -12
  132. package/lib/utils/promptSelect.js +0 -47
  133. package/lib/utils/promptText.d.ts +0 -13
  134. package/lib/utils/promptText.js +0 -53
  135. package/plugins/mariadb/admin/conf/config.user.inc.php +0 -9
  136. package/plugins/serveo/Dockerfile +0 -17
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.injectVariables = void 0;
7
4
  const injectVariables = (str, data) => {
8
- let res = str;
9
- Object.keys(data).forEach(key => {
10
- const variableName = `\\$\\{${key}\\}`;
11
- const variableValue = data[key];
12
- const regex = new RegExp(variableName, 'g');
13
- res = res.replace(regex, variableValue);
14
- });
15
- return res;
5
+ let res = str;
6
+ Object.keys(data).forEach((key) => {
7
+ const variableName = `\\$\\{${key}\\}`;
8
+ const variableValue = data[key];
9
+ const regex = new RegExp(variableName, "g");
10
+ res = res.replace(regex, variableValue);
11
+ });
12
+ return res;
16
13
  };
17
- exports.injectVariables = injectVariables;
14
+ exports.injectVariables = injectVariables;
@@ -1,27 +1,24 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.parseTable = void 0;
7
4
  const parseTable = (string, pos) => {
8
- return string.split("\n").filter(line => {
9
- return line.split(new RegExp("\\s\\s+")).filter(item => {
10
- return item !== "";
11
- }).length > 0;
12
- }).map((line, index) => {
13
- if (index === 0) {
14
- return null;
15
- }
16
- let data = line.split(new RegExp("\\s\\s+"));
17
- let row = {};
18
- for (let i in data) {
19
- let name = pos[i];
20
- row[name] = data[i];
21
- }
22
- return row;
23
- }).filter(line => {
24
- return !!line;
25
- });
5
+ return string.split("\n").filter((line) => {
6
+ return line.split(new RegExp("\\s\\s+")).filter((item) => {
7
+ return item !== "";
8
+ }).length > 0;
9
+ }).map((line, index) => {
10
+ if (index === 0) {
11
+ return null;
12
+ }
13
+ let data = line.split(new RegExp("\\s\\s+"));
14
+ let row = {};
15
+ for (let i in data) {
16
+ let name = pos[i];
17
+ row[name] = data[i];
18
+ }
19
+ return row;
20
+ }).filter((line) => {
21
+ return !!line;
22
+ });
26
23
  };
27
- exports.parseTable = parseTable;
24
+ exports.parseTable = parseTable;
@@ -1,2 +1,2 @@
1
- import { Config } from "src/types";
1
+ import { Config } from "../types";
2
2
  export declare const setConfig: (data: Partial<Config>) => Promise<Config>;
@@ -1,18 +1,15 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.setConfig = void 0;
7
- var _env = require("../env");
8
- var _FS = require("../makes/FS");
9
- var _getConfig = require("./get-config");
10
- const setConfig = async data => {
11
- const config = {
12
- ...(await (0, _getConfig.getConfig)()),
13
- ...data
14
- };
15
- await _FS.FS.writeJSON(_env.MAP_PATH, config);
16
- return config;
4
+ const env_1 = require("../env");
5
+ const FS_1 = require("../makes/FS");
6
+ const get_config_1 = require("./get-config");
7
+ const setConfig = async (data) => {
8
+ const config = {
9
+ ...await (0, get_config_1.getConfig)(),
10
+ ...data
11
+ };
12
+ await FS_1.FS.writeJSON(env_1.MAP_PATH, config);
13
+ return config;
17
14
  };
18
- exports.setConfig = setConfig;
15
+ exports.setConfig = setConfig;
@@ -1,24 +1,21 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.spawn = void 0;
7
- var _child_process = require("child_process");
8
- const spawn = async command => {
9
- return new Promise(resolve => {
10
- let [prog, ...options] = command.split(/\s+/);
11
- let worker = (0, _child_process.spawn)(prog, options);
12
- worker.stdout.on("data", data => {
13
- console.log(`stdout: ${data}`);
4
+ const child_process_1 = require("child_process");
5
+ const spawn = async (command) => {
6
+ return new Promise((resolve) => {
7
+ let [prog, ...options] = command.split(/\s+/);
8
+ let worker = (0, child_process_1.spawn)(prog, options);
9
+ worker.stdout.on("data", (data) => {
10
+ console.log(`stdout: ${data}`);
11
+ });
12
+ worker.stderr.on("data", (data) => {
13
+ console.error(`stderr: ${data}`);
14
+ });
15
+ worker.on("close", (code) => {
16
+ console.log(`child process exited with code ${code}`);
17
+ resolve(undefined);
18
+ });
14
19
  });
15
- worker.stderr.on("data", data => {
16
- console.error(`stderr: ${data}`);
17
- });
18
- worker.on("close", code => {
19
- console.log(`child process exited with code ${code}`);
20
- resolve(undefined);
21
- });
22
- });
23
20
  };
24
- exports.spawn = spawn;
21
+ exports.spawn = spawn;
package/lib/utils/tty.js CHANGED
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.tty = void 0;
7
4
  const tty = () => {
8
- //
9
5
  };
10
- exports.tty = tty;
6
+ exports.tty = tty;
@@ -1,15 +1,8 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.volumeFormat = void 0;
7
- const volumeFormat = volume => {
8
- const {
9
- source,
10
- destination,
11
- options
12
- } = volume;
13
- return `${source}:${destination}` + (options ? `:${options}` : "");
4
+ const volumeFormat = (volume) => {
5
+ const { source, destination, options } = volume;
6
+ return `${source}:${destination}` + (options ? `:${options}` : "");
14
7
  };
15
- exports.volumeFormat = volumeFormat;
8
+ exports.volumeFormat = volumeFormat;
@@ -1,16 +1,13 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.volumeParse = void 0;
7
- const volumeParse = volume => {
8
- const regVolume = /^([^:]+):([^:]+)(?::([^:]+))?$/;
9
- const [, source, destination, options] = regVolume.exec(volume);
10
- return {
11
- source,
12
- destination,
13
- options
14
- };
4
+ const volumeParse = (volume) => {
5
+ const regVolume = /^([^:]+):([^:]+)(?::([^:]+))?$/;
6
+ const [, source, destination, options] = regVolume.exec(volume);
7
+ return {
8
+ source,
9
+ destination,
10
+ options
11
+ };
15
12
  };
16
- exports.volumeParse = volumeParse;
13
+ exports.volumeParse = volumeParse;
package/package.json CHANGED
@@ -1,90 +1,64 @@
1
1
  {
2
2
  "name": "@wocker/ws",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "author": "Kris Papercut <krispcut@gmail.com>",
5
5
  "description": "Docker workspace for web projects",
6
6
  "license": "MIT",
7
- "main": "lib/index.js",
8
- "types": "lib/index.d.ts",
7
+ "homepage": "https://kearisp.github.io/wocker",
9
8
  "repository": {
10
9
  "type": "git",
11
- "url": "git+https://github.com/kearisp/wocker.git"
10
+ "url": "git+https://github.com/kearisp/wocker-ws.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/kearisp/wocker-ws/issues"
12
14
  },
15
+ "main": "lib/index.js",
16
+ "types": "lib/index.d.ts",
13
17
  "bin": {
14
18
  "ws": "./bin/ws.js"
15
19
  },
16
20
  "scripts": {
21
+ "prepare": "npm run build",
17
22
  "start": "npm run watch",
18
- "build": "concurrently \"npm:build:*\"",
19
- "build:root": "npm run babel:build && tsc --emitDeclarationOnly",
20
- "build:cli": "npm run build --workspace @kearisp/cli",
21
- "prepare": "npm run build:root",
22
- "watch": "concurrently \"npm:watch:*\"",
23
- "watch:root": "npm run babel:watch",
24
- "watch:cli": "npm run watch --workspace @kearisp/cli",
25
- "webpack:build": "webpack --mode=development --node-env=development",
26
- "webpack:watch": "webpack --watch",
27
- "babel:build": "babel src --out-dir lib --extensions .js --extensions .ts",
28
- "babel:watch": "npm run babel:build -- --watch",
29
- "ts:build": "tsc",
30
- "ts:watch": "tsc -w",
31
- "test": "jest --colors",
32
- "test:cli": "npm run test --workspace @kearisp/cli",
33
- "test-watch": "jest --colors --watch",
23
+ "build": "tsc",
24
+ "watch": "tsc -w",
34
25
  "lint": "eslint \"**/*.{js,jsx,ts,tsx}\""
35
26
  },
36
- "workspaces": [
37
- "packages/*"
38
- ],
39
27
  "dependencies": {
40
- "@kearisp/cli": "^1.0.1",
28
+ "@kearisp/cli": "^1.0.6",
29
+ "@wocker/core": "^1.0.4",
30
+ "@wocker/utils": "^1.0.2",
41
31
  "async-mutex": "^0.4.0",
42
32
  "axios": "^1.4.0",
43
33
  "chalk": "^2.4.2",
44
34
  "child_process": "^1.0.2",
45
35
  "cli-table3": "^0.6.2",
46
36
  "date-fns": "^2.29.3",
47
- "dockerode": "^3.3.5",
37
+ "dockerode": "^4.0.2",
48
38
  "fs": "^0.0.1-security",
49
39
  "inquirer": "^7.0.0",
50
40
  "md5": "^2.3.0",
51
- "mute-stream": "0.0.8",
52
41
  "os": "^0.1.2",
53
42
  "path": "^0.12.7",
54
43
  "readable-stream": "^4.1.0",
44
+ "reflect-metadata": "^0.2.1",
55
45
  "tty": "^1.0.1"
56
46
  },
57
47
  "devDependencies": {
58
- "@babel/cli": "^7.15.7",
59
- "@babel/core": "^7.22.11",
60
- "@babel/eslint-parser": "^7.15.8",
61
- "@babel/eslint-plugin": "^7.14.5",
62
- "@babel/preset-env": "^7.21.5",
63
- "@babel/preset-typescript": "^7.21.5",
64
- "@types/dockerode": "^3.3.14",
65
- "@types/inquirer": "^8.1.3",
66
- "@types/jest": "^28.1.8",
48
+ "@types/dockerode": "^3.3.23",
49
+ "@types/inquirer": "^7.0.0",
50
+ "@types/jest": "^29.5.12",
67
51
  "@types/lodash": "^4.14.161",
68
52
  "@types/md5": "^2.3.2",
69
53
  "@types/mute-stream": "^0.0.1",
70
- "@types/node": "^18.16.16",
54
+ "@types/node": "^20.11.16",
71
55
  "@types/readable-stream": "^2.3.15",
72
56
  "@typescript-eslint/eslint-plugin": "^6.5.0",
73
57
  "@typescript-eslint/parser": "^6.5.0",
74
- "@webpack-cli/generators": "^3.0.1",
75
- "babel-jest": "^28.0.0",
76
- "babel-loader": "^8.2.3",
77
- "babel-plugin-module-resolver": "^5.0.0",
78
- "concurrently": "^8.2.0",
79
58
  "eslint": "^8.48.0",
80
59
  "eslint-plugin-import": "^2.28.1",
81
60
  "eslint-plugin-node": "^11.1.0",
82
61
  "eslint-webpack-plugin": "^3.1.0",
83
- "jest": "^29.6.3",
84
- "ts-loader": "^9.2.6",
85
- "ts-node": "^10.9.1",
86
- "typescript": "^5.2.2",
87
- "webpack": "^5.60.0",
88
- "webpack-cli": "^4.9.1"
62
+ "typescript": "^5.3.3"
89
63
  }
90
64
  }
@@ -0,0 +1,11 @@
1
+ FROM ubuntu:latest
2
+
3
+ RUN apt-get update && \
4
+ apt-get -y install wget curl unzip
5
+
6
+ RUN curl -fsSL https://bun.sh/install | bash
7
+
8
+ ENV BUN_INSTALL="/root/.bun"
9
+ ENV PATH="$BUN_INSTALL/bin:$PATH"
10
+
11
+ # TODO
@@ -0,0 +1,3 @@
1
+ {
2
+ "dockerfile": "./Dockerfile"
3
+ }
@@ -3,6 +3,9 @@ ARG PACKAGE_MANAGER
3
3
 
4
4
  FROM node:${NODE_VERSION}
5
5
 
6
+ ARG UID=1000
7
+ ARG USER=user
8
+
6
9
  ENV TZ=America/Los_Angeles
7
10
  ENV APP_PORT 80
8
11
  ENV PORT=$APP_PORT
@@ -26,8 +29,7 @@ WORKDIR /usr/app
26
29
 
27
30
  EXPOSE 80
28
31
 
29
- #CMD npm install && \
30
- # ${NPM_RUN}
32
+ USER $UID
31
33
 
32
34
  CMD if [ "$PACKAGE_MANAGER" = "npm" ]; then \
33
35
  npm install --quiet --no-progress; \
@@ -1,30 +1,32 @@
1
1
  {
2
2
  "dockerfile": "./Dockerfile",
3
3
  "DocumentRoot": "/usr/app",
4
- "buildArgs": {
4
+ "buildArgsOptions": {
5
5
  "NODE_VERSION": {
6
6
  "type": "select",
7
- "select": [
8
- "11-alpine3.14",
9
- "12-alpine3.14",
7
+ "options": [
10
8
  "14-alpine3.14",
11
9
  "16-alpine3.14",
12
- "17-alpine3.14"
10
+ "17-alpine3.14",
11
+ "18-alpine3.14"
13
12
  ]
14
13
  }
15
14
  },
16
- "env": {
15
+ "envOptions": {
17
16
  "APP_PORT": {
17
+ "message": "Port",
18
18
  "type": "integer",
19
19
  "default": 80
20
20
  },
21
21
  "NPM_RUN": {
22
+ "message": "Run command",
22
23
  "type": "string",
23
24
  "default": "npm start"
24
25
  },
25
26
  "PACKAGE_MANAGER": {
27
+ "message": "Package manager",
26
28
  "type": "select",
27
- "select": [
29
+ "options": [
28
30
  "npm",
29
31
  "yarn"
30
32
  ]
@@ -3,9 +3,10 @@ ARG PHP_VERSION
3
3
  FROM php:${PHP_VERSION}-apache
4
4
 
5
5
  ARG UID=1000
6
- ARG USER=user
6
+ ARG USER=www-data
7
7
 
8
- RUN useradd -G root,www-data -u $UID -d /home/$USER $USER && \
8
+ RUN usermod -u 1000 www-data && \
9
+ # useradd -G root,www-data -u $UID -d /home/$USER $USER && \
9
10
  mkdir -p /home/$USER && \
10
11
  touch /home/$USER/.bashrc && \
11
12
  chown -R $USER:$USER /home/$USER
@@ -23,22 +24,17 @@ RUN apt-get install -y curl git
23
24
  # libssl-dev \
24
25
  # zlib1g-dev
25
26
 
26
- RUN a2enmod rewrite
27
- RUN a2enmod headers
28
-
29
- # Git
30
- #RUN apt-get install -y git
31
-
32
27
  # Mysqli
33
- ARG MYSQLI_ENABLE=true
28
+ ARG MYSQLI_ENABLE=false
34
29
  RUN if [ "$MYSQLI_ENABLE" = "true" ]; then \
30
+ echo "Install mysqli" && \
35
31
  docker-php-ext-install -j "$(nproc)" mysqli && \
36
32
  docker-php-ext-enable mysqli; \
37
33
  fi
38
34
 
39
35
  # pdo
40
- ARG PDO_MYSQL_ENABLE=true
41
- RUN if [ "$PDO_ENABLE" = "true" ]; then \
36
+ ARG PDO_MYSQL_ENABLE=false
37
+ RUN if [ "$PDO_MYSQL_ENABLE" = "true" ]; then \
42
38
  docker-php-ext-install pdo pdo_mysql && \
43
39
  docker-php-ext-enable pdo_mysql; \
44
40
  fi
@@ -57,14 +53,6 @@ RUN if [ "$GD_ENABLE" = "true" ]; then \
57
53
  docker-php-ext-install exif; \
58
54
  fi
59
55
 
60
- #RUN compare-version $PHP_VERSION "7.3" && \
61
- # docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include || \
62
- # docker-php-ext-configure gd --with-freetype --with-jpeg
63
-
64
- #RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
65
- #RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
66
- #RUN docker-php-ext-install gd
67
-
68
56
  # Zip
69
57
  ARG ZIP_ENABLE=false
70
58
  RUN if [ "$ZIP_ENABLE" = "true" ]; then \
@@ -79,21 +67,6 @@ RUN if [ "$ZIP_ENABLE" = "true" ]; then \
79
67
  # docker-php-ext-configure zip || \
80
68
  # docker-php-ext-configure zip --with-libzip
81
69
 
82
- ADD ./etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf
83
- ADD ./etc/apache2/apache2.conf /etc/apache2/apache2.conf
84
- COPY ./etc/apache2/mods-available/mpm_prefork.conf /etc/apache2/mods-available/
85
-
86
- #RUN touch /usr/local/etc/php/conf.d/mail.ini && \
87
- # echo "SMTP = maildev.workspace" >> /usr/local/etc/php/conf.d/mail.ini && \
88
- # echo "smtp_port = 25" >> /usr/local/etc/php/conf.d/mail.ini
89
-
90
- #RUN touch /usr/local/etc/php/conf.d/uploads.ini && \
91
- # echo "upload_max_filesize = 100M;" >> /usr/local/etc/php/conf.d/uploads.ini && \
92
- # echo "post_max_size = 100M;" >> /usr/local/etc/php/conf.d/uploads.ini
93
-
94
- #RUN touch /usr/local/etc/php/conf.d/memory.ini && \
95
- # echo "memory_limit = 256M;" >> /usr/local/etc/php/conf.d/memory.ini
96
-
97
70
  # Composer
98
71
  ARG COMPOSER_ENABLE=false
99
72
 
@@ -110,11 +83,10 @@ RUN if [ "$COMPOSER_ENABLE" = "true" ]; then \
110
83
  fi
111
84
  SHELL ["/bin/sh", "-c"]
112
85
 
113
- USER $USER
114
-
115
86
  # NodeJS
87
+ #USER $USER
116
88
  ARG NODE_VERSION=''
117
- ENV NVM_DIR=/home/$USER/.nvm
89
+ ENV NVM_DIR=/root/.nvm
118
90
 
119
91
  RUN if [ "$NODE_VERSION" != "" ] && [ "$NODE_VERSION" != "none" ]; then \
120
92
  mkdir -p $NVM_DIR; \
@@ -123,11 +95,41 @@ RUN if [ "$NODE_VERSION" != "" ] && [ "$NODE_VERSION" != "none" ]; then \
123
95
  nvm install $NODE_VERSION && \
124
96
  nvm alias default $NODE_VERSION && \
125
97
  nvm use default; \
126
- echo "[ -n \"\$(command -v npm)\" ] && . <(npm completion)" >> /home/$USER/.bashrc; \
98
+ echo "[ -n \"\$(command -v npm)\" ] && . <(npm completion)" >> /.bashrc; \
127
99
  fi
128
100
 
101
+ #USER root
102
+
103
+ RUN a2enmod rewrite
104
+ RUN a2enmod headers
105
+
106
+ ADD ./etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf
107
+ ADD ./etc/apache2/apache2.conf /etc/apache2/apache2.conf
108
+ COPY ./etc/apache2/mods-available/mpm_prefork.conf /etc/apache2/mods-available/
109
+
110
+ #RUN touch /usr/local/etc/php/conf.d/mail.ini && \
111
+ # echo "SMTP = maildev.workspace" >> /usr/local/etc/php/conf.d/mail.ini && \
112
+ # echo "smtp_port = 25" >> /usr/local/etc/php/conf.d/mail.ini
113
+
114
+ #RUN touch /usr/local/etc/php/conf.d/uploads.ini && \
115
+ # echo "upload_max_filesize = 100M;" >> /usr/local/etc/php/conf.d/uploads.ini && \
116
+ # echo "post_max_size = 100M;" >> /usr/local/etc/php/conf.d/uploads.ini
117
+
118
+ #RUN touch /usr/local/etc/php/conf.d/memory.ini && \
119
+ # echo "memory_limit = 256M;" >> /usr/local/etc/php/conf.d/memory.ini
120
+
121
+ RUN touch /usr/local/bin/docker-entrypoint && \
122
+ echo "#!/bin/bash" >> /usr/local/bin/docker-entrypoint && \
123
+ echo "source /root/.bashrc" >> /usr/local/bin/docker-entrypoint && \
124
+ echo "exec docker-php-entrypoint \"\$@\"" >> /usr/local/bin/docker-entrypoint && \
125
+ chmod 775 /usr/local/bin/docker-entrypoint && \
126
+ chmod +x /usr/local/bin/docker-entrypoint
127
+
129
128
  ENV APACHE_DOCUMENT_ROOT /var/www
130
129
  WORKDIR $APACHE_DOCUMENT_ROOT
131
130
 
132
131
  EXPOSE 80
133
132
  EXPOSE 443
133
+
134
+ ENTRYPOINT ["docker-entrypoint"]
135
+ CMD ["apache2-foreground"]
@@ -13,26 +13,21 @@
13
13
  "8.2"
14
14
  ]
15
15
  },
16
- "MYSQLI_ENABLE": {
17
- "message": "Enable mysqli?",
18
- "type": "boolean"
19
- },
20
- "PDO_MYSQL_ENABLE": {
21
- "message": "Enable PDO Mysql?",
22
- "type": "boolean"
23
- },
24
- "GD_ENABLE": {
25
- "message": "Enable GD?",
26
- "type": "boolean"
16
+ "EXTENSIONS": {
17
+ "type": "select",
18
+ "multiple": true,
19
+ "message": "Extensions",
20
+ "options": {
21
+ "MYSQLI_ENABLE": "Mysqli",
22
+ "PDO_MYSQL_ENABLE": "PDO",
23
+ "GD_ENABLE": "GD",
24
+ "ZIP_ENABLE": "Zip"
25
+ }
27
26
  },
28
27
  "COMPOSER_ENABLE": {
29
28
  "message": "Install composer?",
30
29
  "type": "boolean"
31
30
  },
32
- "ZIP_ENABLE": {
33
- "message": "Enable zip?",
34
- "type": "boolean"
35
- },
36
31
  "NODE_VERSION": {
37
32
  "type": "select",
38
33
  "message": "Node version",
@@ -0,0 +1,21 @@
1
+ ARG PHP_VERSION
2
+
3
+ FROM php:${PHP_VERSION}-fpm
4
+
5
+ #RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
6
+
7
+ #RUN touch /usr/local/bin/docker-entrypoint && \
8
+ # echo "#!/bin/sh" >> /usr/local/bin/docker-entrypoint && \
9
+ # echo "" >> /usr/local/bin/docker-entrypoint && \
10
+ # echo "exec docker-php-entrypoint \"\$@\"" >> /usr/local/bin/docker-entrypoint && \
11
+ # chmod 775 /usr/local/bin/docker-entrypoint && \
12
+ # chmod +x /usr/local/bin/docker-entrypoint
13
+
14
+ #ENV WORKDIR /var/www/html
15
+ WORKDIR /var/www/html
16
+
17
+ EXPOSE 9000
18
+
19
+
20
+ #ENTRYPOINT ["docker-entrypoint"]
21
+ CMD ["php-fpm"]
@@ -0,0 +1,25 @@
1
+ {
2
+ "dockerfile": "./Dockerfile",
3
+ "buildArgsOptions": {
4
+ "PHP_VERSION": {
5
+ "message": "PHP version",
6
+ "type": "select",
7
+ "hash": false,
8
+ "options": [
9
+ "8.0",
10
+ "8.1",
11
+ "8.2"
12
+ ]
13
+ }
14
+ },
15
+ "envOptions": {
16
+ "WORKDIR": {
17
+ "type": "string",
18
+ "message": "Workdir",
19
+ "default": "/var/www/html"
20
+ }
21
+ },
22
+ "volumeOptions": [
23
+ "./:/var/www/html"
24
+ ]
25
+ }
@@ -1,19 +0,0 @@
1
- import { PromptGroupOptions } from "src/utils";
2
- import { Project } from "./Project";
3
- export declare class Preset {
4
- id: string;
5
- name: string;
6
- dockerfile?: string;
7
- buildArgsOptions?: PromptGroupOptions<{
8
- hash?: boolean;
9
- }>;
10
- envOptions?: PromptGroupOptions;
11
- volumeOptions?: string[];
12
- volumes?: string[];
13
- constructor(data?: Preset);
14
- getImageArgs(project: Project): import("../types").EnvConfig;
15
- getImageName(buildArgs: {
16
- [key: string]: string;
17
- }): string;
18
- static get(name: string): Promise<Preset>;
19
- }