@wocker/ws 1.0.1 → 1.0.2

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 (98) hide show
  1. package/.github/workflows/publish.yml +31 -0
  2. package/README.md +11 -137
  3. package/bin/ws.js +7 -3
  4. package/lib/App.d.ts +7 -5
  5. package/lib/App.js +45 -11
  6. package/lib/controllers/ImageController.d.ts +3 -1
  7. package/lib/controllers/ImageController.js +3 -1
  8. package/lib/controllers/PluginController.d.ts +14 -0
  9. package/lib/controllers/PluginController.js +62 -0
  10. package/lib/controllers/PresetController.d.ts +19 -0
  11. package/lib/controllers/PresetController.js +150 -0
  12. package/lib/controllers/ProjectController.d.ts +13 -5
  13. package/lib/controllers/ProjectController.js +92 -25
  14. package/lib/{plugins/ProxyPlugin.d.ts → controllers/ProxyController.d.ts} +9 -11
  15. package/lib/{plugins/ProxyPlugin.js → controllers/ProxyController.js} +120 -128
  16. package/lib/controllers/index.d.ts +3 -0
  17. package/lib/controllers/index.js +33 -0
  18. package/lib/env.js +9 -16
  19. package/lib/index.js +11 -24
  20. package/lib/makes/Docker.js +11 -25
  21. package/lib/makes/FS.d.ts +1 -1
  22. package/lib/makes/FS.js +13 -10
  23. package/lib/makes/Logger.d.ts +1 -7
  24. package/lib/makes/Logger.js +6 -33
  25. package/lib/makes/Plugin.js +2 -2
  26. package/lib/plugins/ElasticSearchPlugin.d.ts +16 -0
  27. package/lib/plugins/ElasticSearchPlugin.js +72 -0
  28. package/lib/plugins/LocaltunnelPlugin.d.ts +3 -3
  29. package/lib/plugins/LocaltunnelPlugin.js +17 -15
  30. package/lib/plugins/MaildevPlugin.d.ts +3 -1
  31. package/lib/plugins/MaildevPlugin.js +8 -5
  32. package/lib/plugins/MongodbPlugin.d.ts +5 -3
  33. package/lib/plugins/MongodbPlugin.js +10 -16
  34. package/lib/plugins/NgrokPlugin.d.ts +2 -3
  35. package/lib/plugins/NgrokPlugin.js +7 -6
  36. package/lib/plugins/PageKitePlugin.d.ts +2 -3
  37. package/lib/plugins/PageKitePlugin.js +8 -6
  38. package/lib/plugins/PostgresPlugin.js +5 -4
  39. package/lib/plugins/ProxmoxPlugin.js +2 -2
  40. package/lib/plugins/RedisPlugin.d.ts +8 -2
  41. package/lib/plugins/RedisPlugin.js +57 -20
  42. package/lib/plugins/index.d.ts +2 -6
  43. package/lib/plugins/index.js +11 -66
  44. package/lib/services/AppConfigService.d.ts +14 -4
  45. package/lib/services/AppConfigService.js +88 -3
  46. package/lib/services/AppEventsService.d.ts +5 -8
  47. package/lib/services/AppEventsService.js +2 -3
  48. package/lib/services/DockerService.d.ts +16 -0
  49. package/lib/services/DockerService.js +220 -0
  50. package/lib/services/LogService.d.ts +11 -0
  51. package/lib/services/LogService.js +39 -0
  52. package/lib/services/PluginService.d.ts +10 -0
  53. package/lib/services/PluginService.js +18 -0
  54. package/lib/services/PresetService.d.ts +9 -0
  55. package/lib/services/PresetService.js +63 -0
  56. package/lib/services/ProjectService.d.ts +8 -7
  57. package/lib/services/ProjectService.js +64 -12
  58. package/lib/services/index.d.ts +4 -0
  59. package/lib/services/index.js +44 -0
  60. package/lib/utils/demuxOutput.js +0 -2
  61. package/lib/utils/exec.d.ts +1 -1
  62. package/lib/utils/exec.js +4 -5
  63. package/lib/utils/fetch.js +3 -4
  64. package/lib/utils/image-build.js +2 -2
  65. package/lib/utils/index.d.ts +0 -4
  66. package/lib/utils/index.js +0 -44
  67. package/lib/utils/injectVariables.js +1 -1
  68. package/package.json +13 -13
  69. package/presets/node/config.json +9 -7
  70. package/presets/php-apache/Dockerfile +37 -36
  71. package/presets/php-apache/config.json +10 -15
  72. package/presets/php-fpm/Dockerfile +21 -0
  73. package/presets/php-fpm/config.json +25 -0
  74. package/lib/models/Preset.d.ts +0 -19
  75. package/lib/models/Preset.js +0 -60
  76. package/lib/models/Project.d.ts +0 -38
  77. package/lib/models/Project.js +0 -151
  78. package/lib/models/index.d.ts +0 -2
  79. package/lib/models/index.js +0 -27
  80. package/lib/plugins/MariadbPlugin.d.ts +0 -25
  81. package/lib/plugins/MariadbPlugin.js +0 -297
  82. package/lib/plugins/PresetPlugin.d.ts +0 -19
  83. package/lib/plugins/PresetPlugin.js +0 -164
  84. package/lib/plugins/ProjectPlugin.d.ts +0 -12
  85. package/lib/plugins/ProjectPlugin.js +0 -54
  86. package/lib/plugins/ServeoPlugin.d.ts +0 -36
  87. package/lib/plugins/ServeoPlugin.js +0 -260
  88. package/lib/plugins/TestPlugin.d.ts +0 -10
  89. package/lib/plugins/TestPlugin.js +0 -75
  90. package/lib/utils/promptConfirm.d.ts +0 -6
  91. package/lib/utils/promptConfirm.js +0 -21
  92. package/lib/utils/promptGroup.d.ts +0 -16
  93. package/lib/utils/promptGroup.js +0 -39
  94. package/lib/utils/promptSelect.d.ts +0 -12
  95. package/lib/utils/promptSelect.js +0 -47
  96. package/lib/utils/promptText.d.ts +0 -13
  97. package/lib/utils/promptText.js +0 -53
  98. package/plugins/serveo/Dockerfile +0 -17
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.imageBuild = void 0;
7
7
  var _exec = require("./exec");
8
8
  var Path = _interopRequireWildcard(require("path"));
9
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
11
  const imageBuild = async options => {
12
12
  const {
13
13
  tag,
@@ -10,10 +10,6 @@ export * from "./get-cursor-position";
10
10
  export * from "./image-build";
11
11
  export * from "./injectVariables";
12
12
  export * from "./parse-table";
13
- export * from "./promptConfirm";
14
- export * from "./promptGroup";
15
- export * from "./promptSelect";
16
- export * from "./promptText";
17
13
  export * from "./set-config";
18
14
  export * from "./spawn";
19
15
  export * from "./tty";
@@ -135,50 +135,6 @@ Object.keys(_parseTable).forEach(function (key) {
135
135
  }
136
136
  });
137
137
  });
138
- var _promptConfirm = require("./promptConfirm");
139
- Object.keys(_promptConfirm).forEach(function (key) {
140
- if (key === "default" || key === "__esModule") return;
141
- if (key in exports && exports[key] === _promptConfirm[key]) return;
142
- Object.defineProperty(exports, key, {
143
- enumerable: true,
144
- get: function () {
145
- return _promptConfirm[key];
146
- }
147
- });
148
- });
149
- var _promptGroup = require("./promptGroup");
150
- Object.keys(_promptGroup).forEach(function (key) {
151
- if (key === "default" || key === "__esModule") return;
152
- if (key in exports && exports[key] === _promptGroup[key]) return;
153
- Object.defineProperty(exports, key, {
154
- enumerable: true,
155
- get: function () {
156
- return _promptGroup[key];
157
- }
158
- });
159
- });
160
- var _promptSelect = require("./promptSelect");
161
- Object.keys(_promptSelect).forEach(function (key) {
162
- if (key === "default" || key === "__esModule") return;
163
- if (key in exports && exports[key] === _promptSelect[key]) return;
164
- Object.defineProperty(exports, key, {
165
- enumerable: true,
166
- get: function () {
167
- return _promptSelect[key];
168
- }
169
- });
170
- });
171
- var _promptText = require("./promptText");
172
- Object.keys(_promptText).forEach(function (key) {
173
- if (key === "default" || key === "__esModule") return;
174
- if (key in exports && exports[key] === _promptText[key]) return;
175
- Object.defineProperty(exports, key, {
176
- enumerable: true,
177
- get: function () {
178
- return _promptText[key];
179
- }
180
- });
181
- });
182
138
  var _setConfig = require("./set-config");
183
139
  Object.keys(_setConfig).forEach(function (key) {
184
140
  if (key === "default" || key === "__esModule") return;
@@ -9,7 +9,7 @@ const injectVariables = (str, data) => {
9
9
  Object.keys(data).forEach(key => {
10
10
  const variableName = `\\$\\{${key}\\}`;
11
11
  const variableValue = data[key];
12
- const regex = new RegExp(variableName, 'g');
12
+ const regex = new RegExp(variableName, "g");
13
13
  res = res.replace(regex, variableValue);
14
14
  });
15
15
  return res;
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
2
  "name": "@wocker/ws",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "author": "Kris Papercut <krispcut@gmail.com>",
5
5
  "description": "Docker workspace for web projects",
6
6
  "license": "MIT",
7
7
  "main": "lib/index.js",
8
8
  "types": "lib/index.d.ts",
9
+ "homepage": "https://kearisp.github.io/wocker",
9
10
  "repository": {
10
11
  "type": "git",
11
- "url": "git+https://github.com/kearisp/wocker.git"
12
+ "url": "git+https://github.com/kearisp/wocker-ws.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/kearisp/wocker-ws/issues"
12
16
  },
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",
23
+ "build": "npm run babel:build && tsc --emitDeclarationOnly",
24
+ "watch": "npm run babel:watch",
25
25
  "webpack:build": "webpack --mode=development --node-env=development",
26
26
  "webpack:watch": "webpack --watch",
27
27
  "babel:build": "babel src --out-dir lib --extensions .js --extensions .ts",
@@ -37,7 +37,9 @@
37
37
  "packages/*"
38
38
  ],
39
39
  "dependencies": {
40
- "@kearisp/cli": "^1.0.1",
40
+ "@kearisp/cli": "^1.0.2",
41
+ "@wocker/core": "^1.0.2",
42
+ "@wocker/utils": "^1.0.2",
41
43
  "async-mutex": "^0.4.0",
42
44
  "axios": "^1.4.0",
43
45
  "chalk": "^2.4.2",
@@ -48,7 +50,6 @@
48
50
  "fs": "^0.0.1-security",
49
51
  "inquirer": "^7.0.0",
50
52
  "md5": "^2.3.0",
51
- "mute-stream": "0.0.8",
52
53
  "os": "^0.1.2",
53
54
  "path": "^0.12.7",
54
55
  "readable-stream": "^4.1.0",
@@ -62,7 +63,7 @@
62
63
  "@babel/preset-env": "^7.21.5",
63
64
  "@babel/preset-typescript": "^7.21.5",
64
65
  "@types/dockerode": "^3.3.14",
65
- "@types/inquirer": "^8.1.3",
66
+ "@types/inquirer": "^7.0.0",
66
67
  "@types/jest": "^28.1.8",
67
68
  "@types/lodash": "^4.14.161",
68
69
  "@types/md5": "^2.3.2",
@@ -75,7 +76,6 @@
75
76
  "babel-jest": "^28.0.0",
76
77
  "babel-loader": "^8.2.3",
77
78
  "babel-plugin-module-resolver": "^5.0.0",
78
- "concurrently": "^8.2.0",
79
79
  "eslint": "^8.48.0",
80
80
  "eslint-plugin-import": "^2.28.1",
81
81
  "eslint-plugin-node": "^11.1.0",
@@ -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
  ]
@@ -23,22 +23,17 @@ RUN apt-get install -y curl git
23
23
  # libssl-dev \
24
24
  # zlib1g-dev
25
25
 
26
- RUN a2enmod rewrite
27
- RUN a2enmod headers
28
-
29
- # Git
30
- #RUN apt-get install -y git
31
-
32
26
  # Mysqli
33
- ARG MYSQLI_ENABLE=true
27
+ ARG MYSQLI_ENABLE=false
34
28
  RUN if [ "$MYSQLI_ENABLE" = "true" ]; then \
29
+ echo "Install mysqli" && \
35
30
  docker-php-ext-install -j "$(nproc)" mysqli && \
36
31
  docker-php-ext-enable mysqli; \
37
32
  fi
38
33
 
39
34
  # pdo
40
- ARG PDO_MYSQL_ENABLE=true
41
- RUN if [ "$PDO_ENABLE" = "true" ]; then \
35
+ ARG PDO_MYSQL_ENABLE=false
36
+ RUN if [ "$PDO_MYSQL_ENABLE" = "true" ]; then \
42
37
  docker-php-ext-install pdo pdo_mysql && \
43
38
  docker-php-ext-enable pdo_mysql; \
44
39
  fi
@@ -57,14 +52,6 @@ RUN if [ "$GD_ENABLE" = "true" ]; then \
57
52
  docker-php-ext-install exif; \
58
53
  fi
59
54
 
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
55
  # Zip
69
56
  ARG ZIP_ENABLE=false
70
57
  RUN if [ "$ZIP_ENABLE" = "true" ]; then \
@@ -79,21 +66,6 @@ RUN if [ "$ZIP_ENABLE" = "true" ]; then \
79
66
  # docker-php-ext-configure zip || \
80
67
  # docker-php-ext-configure zip --with-libzip
81
68
 
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
69
  # Composer
98
70
  ARG COMPOSER_ENABLE=false
99
71
 
@@ -110,11 +82,10 @@ RUN if [ "$COMPOSER_ENABLE" = "true" ]; then \
110
82
  fi
111
83
  SHELL ["/bin/sh", "-c"]
112
84
 
113
- USER $USER
114
-
115
85
  # NodeJS
86
+ #USER $USER
116
87
  ARG NODE_VERSION=''
117
- ENV NVM_DIR=/home/$USER/.nvm
88
+ ENV NVM_DIR=/root/.nvm
118
89
 
119
90
  RUN if [ "$NODE_VERSION" != "" ] && [ "$NODE_VERSION" != "none" ]; then \
120
91
  mkdir -p $NVM_DIR; \
@@ -123,11 +94,41 @@ RUN if [ "$NODE_VERSION" != "" ] && [ "$NODE_VERSION" != "none" ]; then \
123
94
  nvm install $NODE_VERSION && \
124
95
  nvm alias default $NODE_VERSION && \
125
96
  nvm use default; \
126
- echo "[ -n \"\$(command -v npm)\" ] && . <(npm completion)" >> /home/$USER/.bashrc; \
97
+ echo "[ -n \"\$(command -v npm)\" ] && . <(npm completion)" >> /.bashrc; \
127
98
  fi
128
99
 
100
+ #USER root
101
+
102
+ RUN a2enmod rewrite
103
+ RUN a2enmod headers
104
+
105
+ ADD ./etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf
106
+ ADD ./etc/apache2/apache2.conf /etc/apache2/apache2.conf
107
+ COPY ./etc/apache2/mods-available/mpm_prefork.conf /etc/apache2/mods-available/
108
+
109
+ #RUN touch /usr/local/etc/php/conf.d/mail.ini && \
110
+ # echo "SMTP = maildev.workspace" >> /usr/local/etc/php/conf.d/mail.ini && \
111
+ # echo "smtp_port = 25" >> /usr/local/etc/php/conf.d/mail.ini
112
+
113
+ #RUN touch /usr/local/etc/php/conf.d/uploads.ini && \
114
+ # echo "upload_max_filesize = 100M;" >> /usr/local/etc/php/conf.d/uploads.ini && \
115
+ # echo "post_max_size = 100M;" >> /usr/local/etc/php/conf.d/uploads.ini
116
+
117
+ #RUN touch /usr/local/etc/php/conf.d/memory.ini && \
118
+ # echo "memory_limit = 256M;" >> /usr/local/etc/php/conf.d/memory.ini
119
+
120
+ RUN touch /usr/local/bin/docker-entrypoint && \
121
+ echo "#!/bin/bash" >> /usr/local/bin/docker-entrypoint && \
122
+ echo "source /root/.bashrc" >> /usr/local/bin/docker-entrypoint && \
123
+ echo "exec docker-php-entrypoint \"\$@\"" >> /usr/local/bin/docker-entrypoint && \
124
+ chmod 775 /usr/local/bin/docker-entrypoint && \
125
+ chmod +x /usr/local/bin/docker-entrypoint
126
+
129
127
  ENV APACHE_DOCUMENT_ROOT /var/www
130
128
  WORKDIR $APACHE_DOCUMENT_ROOT
131
129
 
132
130
  EXPOSE 80
133
131
  EXPOSE 443
132
+
133
+ ENTRYPOINT ["docker-entrypoint"]
134
+ 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
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Preset = void 0;
7
- var Path = _interopRequireWildcard(require("path"));
8
- var _md = _interopRequireDefault(require("md5"));
9
- var _env = require("../env");
10
- var _makes = require("../makes");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
- class Preset {
15
- constructor(data) {
16
- if (data) {
17
- for (const i in data) {
18
- this[i] = data[i];
19
- }
20
- }
21
- }
22
- getImageArgs(project) {
23
- if (!this.buildArgsOptions) {
24
- return {};
25
- }
26
- return Object.keys(this.buildArgsOptions).reduce((buildArgs, key) => {
27
- buildArgs[key] = project.buildArgs[key];
28
- return buildArgs;
29
- }, {});
30
- }
31
- getImageName(buildArgs) {
32
- const rawValues = [];
33
- const hashValues = [];
34
- Object.keys(buildArgs).forEach(key => {
35
- const {
36
- [key]: {
37
- hash = true
38
- } = {}
39
- } = this.buildArgsOptions || {};
40
- const value = buildArgs[key];
41
- if (hash) {
42
- hashValues.push(value);
43
- } else {
44
- rawValues.push(value);
45
- }
46
- });
47
- const version = [...rawValues, (0, _md.default)(hashValues.join(",")).substr(0, 6)].filter(value => {
48
- return !!value;
49
- }).join("-");
50
- return `ws-preset-${this.name}:${version}`;
51
- }
52
- static async get(name) {
53
- const data = await _makes.FS.readJSON(Path.join(_env.PRESETS_DIR, name, "config.json"));
54
- return new Preset({
55
- name,
56
- ...data
57
- });
58
- }
59
- }
60
- exports.Preset = Preset;
@@ -1,38 +0,0 @@
1
- import { EnvConfig } from "src/types";
2
- type SearchOptions = {
3
- id: string;
4
- name: string;
5
- src: string;
6
- };
7
- export declare class Project {
8
- id: string;
9
- type: string;
10
- name: string;
11
- path: string;
12
- dockerfile?: string;
13
- imageName?: string;
14
- buildArgs?: EnvConfig;
15
- env?: EnvConfig;
16
- domains?: string[];
17
- volumes?: string[];
18
- meta?: {
19
- [key: string]: string;
20
- };
21
- setEnv(name: string, value: string | boolean): void;
22
- getEnv(name: string, defaultValue?: string): string;
23
- unsetEnv(name: string): void;
24
- getMeta(name: string, defaultValue?: string): string | undefined;
25
- setMeta(name: string, value: string): void;
26
- volumeMount(...volumes: string[]): void;
27
- getVolumeBySource(source: string): string | undefined;
28
- getVolumeByDestination(destination: string): string | undefined;
29
- volumeUnmount(...volumes: string[]): void;
30
- static get(id: string): Promise<void>;
31
- save(): Promise<void>;
32
- static fromObject(data: any): Project;
33
- static search(params?: Partial<SearchOptions>): Promise<Project[]>;
34
- static searchOne(params?: Partial<SearchOptions>): Promise<Project | null>;
35
- }
36
- export declare const PROJECT_TYPE_DOCKERFILE = "dockerfile";
37
- export declare const PROJECT_TYPE_IMAGE = "image";
38
- export {};