@wocker/ws 1.0.6 → 1.0.8

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 (101) hide show
  1. package/bin/ws.js +1 -1
  2. package/lib/App.d.ts +1 -6
  3. package/lib/App.js +1 -27
  4. package/lib/AppModule.d.ts +6 -0
  5. package/lib/AppModule.js +97 -0
  6. package/lib/controllers/CompletionController.d.ts +6 -0
  7. package/lib/controllers/CompletionController.js +32 -0
  8. package/lib/controllers/ImageController.d.ts +5 -8
  9. package/lib/controllers/ImageController.js +27 -12
  10. package/lib/controllers/PluginController.d.ts +9 -13
  11. package/lib/controllers/PluginController.js +56 -18
  12. package/lib/controllers/PresetController.d.ts +9 -15
  13. package/lib/controllers/PresetController.js +41 -22
  14. package/lib/controllers/ProjectController.d.ts +27 -69
  15. package/lib/controllers/ProjectController.js +336 -261
  16. package/lib/controllers/ProxyController.d.ts +15 -25
  17. package/lib/controllers/ProxyController.js +142 -96
  18. package/lib/controllers/index.d.ts +1 -0
  19. package/lib/controllers/index.js +1 -0
  20. package/lib/index.d.ts +0 -1
  21. package/lib/index.js +0 -11
  22. package/lib/main.d.ts +3 -0
  23. package/lib/main.js +11 -0
  24. package/lib/makes/Logger.d.ts +2 -2
  25. package/lib/makes/Logger.js +19 -8
  26. package/lib/makes/Preset.d.ts +3 -4
  27. package/lib/makes/Preset.js +19 -8
  28. package/lib/makes/index.d.ts +0 -6
  29. package/lib/makes/index.js +0 -6
  30. package/lib/plugins/ElasticSearchPlugin.d.ts +5 -6
  31. package/lib/plugins/ElasticSearchPlugin.js +19 -8
  32. package/lib/plugins/LocaltunnelPlugin.d.ts +8 -8
  33. package/lib/plugins/LocaltunnelPlugin.js +25 -10
  34. package/lib/plugins/MaildevPlugin.d.ts +5 -6
  35. package/lib/plugins/MaildevPlugin.js +21 -8
  36. package/lib/plugins/MongodbPlugin.d.ts +5 -5
  37. package/lib/plugins/MongodbPlugin.js +26 -11
  38. package/lib/plugins/NgrokPlugin.d.ts +7 -6
  39. package/lib/plugins/NgrokPlugin.js +32 -17
  40. package/lib/plugins/PageKitePlugin.d.ts +10 -8
  41. package/lib/plugins/PageKitePlugin.js +36 -20
  42. package/lib/plugins/ProxmoxPlugin.d.ts +8 -5
  43. package/lib/plugins/ProxmoxPlugin.js +25 -9
  44. package/lib/plugins/RedisPlugin.d.ts +4 -6
  45. package/lib/plugins/RedisPlugin.js +19 -8
  46. package/lib/plugins/index.d.ts +0 -2
  47. package/lib/plugins/index.js +0 -2
  48. package/lib/services/AppConfigService.d.ts +3 -3
  49. package/lib/services/AppConfigService.js +16 -2
  50. package/lib/services/AppEventsService.d.ts +1 -2
  51. package/lib/services/AppEventsService.js +11 -2
  52. package/lib/services/DockerService.d.ts +9 -39
  53. package/lib/services/DockerService.js +122 -4
  54. package/lib/services/LogService.d.ts +3 -5
  55. package/lib/services/LogService.js +19 -4
  56. package/lib/services/PluginService.d.ts +4 -9
  57. package/lib/services/PluginService.js +18 -8
  58. package/lib/services/PresetService.d.ts +5 -5
  59. package/lib/services/PresetService.js +11 -2
  60. package/lib/services/ProjectService.d.ts +9 -6
  61. package/lib/services/ProjectService.js +62 -31
  62. package/lib/utils/get-config.d.ts +2 -2
  63. package/lib/utils/index.d.ts +0 -1
  64. package/lib/utils/index.js +0 -1
  65. package/lib/utils/set-config.d.ts +2 -2
  66. package/package.json +6 -6
  67. package/presets/node/config.json +1 -1
  68. package/presets/php-apache/Dockerfile +24 -0
  69. package/presets/php-apache/config.json +4 -1
  70. package/presets/php-fpm/Dockerfile +164 -12
  71. package/presets/php-fpm/bin/compare-version +3 -0
  72. package/presets/php-fpm/config.json +34 -5
  73. package/presets/php-fpm/etc/nginx/sites-available/default.conf +36 -0
  74. package/lib/decorators/Inject.d.ts +0 -1
  75. package/lib/decorators/Inject.js +0 -8
  76. package/lib/decorators/Injectable.d.ts +0 -4
  77. package/lib/decorators/Injectable.js +0 -17
  78. package/lib/decorators/index.d.ts +0 -1
  79. package/lib/decorators/index.js +0 -17
  80. package/lib/makes/Controller.d.ts +0 -5
  81. package/lib/makes/Controller.js +0 -8
  82. package/lib/makes/DI.d.ts +0 -7
  83. package/lib/makes/DI.js +0 -27
  84. package/lib/makes/Docker.d.ts +0 -58
  85. package/lib/makes/Docker.js +0 -320
  86. package/lib/makes/Plugin.d.ts +0 -13
  87. package/lib/makes/Plugin.js +0 -61
  88. package/lib/makes/Project.d.ts +0 -45
  89. package/lib/makes/Project.js +0 -127
  90. package/lib/makes/Repository.d.ts +0 -11
  91. package/lib/makes/Repository.js +0 -22
  92. package/lib/plugins/PostgresPlugin.d.ts +0 -16
  93. package/lib/plugins/PostgresPlugin.js +0 -121
  94. package/lib/types/Config.d.ts +0 -12
  95. package/lib/types/Config.js +0 -2
  96. package/lib/types/EnvConfig.d.ts +0 -3
  97. package/lib/types/EnvConfig.js +0 -2
  98. package/lib/types/index.d.ts +0 -2
  99. package/lib/types/index.js +0 -18
  100. package/lib/utils/demuxOutput.d.ts +0 -2
  101. package/lib/utils/demuxOutput.js +0 -19
@@ -1,4 +1,4 @@
1
- import { DI, Project } from "../makes";
1
+ import { Project, PickProperties } from "@wocker/core";
2
2
  import { DockerService, AppConfigService, AppEventsService } from "../services";
3
3
  type SearchParams = Partial<{
4
4
  id: string;
@@ -6,16 +6,19 @@ type SearchParams = Partial<{
6
6
  path: string;
7
7
  }>;
8
8
  declare class ProjectService {
9
- protected appConfigService: AppConfigService;
10
- protected appEventsService: AppEventsService;
11
- protected dockerService: DockerService;
12
- constructor(di: DI);
9
+ protected readonly appConfigService: AppConfigService;
10
+ protected readonly appEventsService: AppEventsService;
11
+ protected readonly dockerService: DockerService;
12
+ constructor(appConfigService: AppConfigService, appEventsService: AppEventsService, dockerService: DockerService);
13
+ fromObject(data: Partial<PickProperties<Project>>): Project;
14
+ getById(id: string): Promise<Project>;
13
15
  cdProject(name: string): Promise<void>;
14
16
  get(): Promise<Project>;
15
17
  getContainer(): Promise<import("dockerode").Container>;
16
- start(): Promise<void>;
18
+ start(restart?: boolean): Promise<void>;
17
19
  stop(): Promise<void>;
18
20
  save(project: Project): Promise<void>;
19
21
  search(params?: Partial<SearchParams>): Promise<Project[]>;
22
+ searchOne(params?: Partial<SearchParams>): Promise<Project | null>;
20
23
  }
21
24
  export { ProjectService };
@@ -15,6 +15,12 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
18
24
  var __importStar = (this && this.__importStar) || function (mod) {
19
25
  if (mod && mod.__esModule) return mod;
20
26
  var result = {};
@@ -22,19 +28,38 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
28
  __setModuleDefault(result, mod);
23
29
  return result;
24
30
  };
31
+ var __metadata = (this && this.__metadata) || function (k, v) {
32
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
+ };
25
34
  Object.defineProperty(exports, "__esModule", { value: true });
26
35
  exports.ProjectService = void 0;
36
+ const core_1 = require("@wocker/core");
27
37
  const Path = __importStar(require("path"));
28
38
  const makes_1 = require("../makes");
29
39
  const services_1 = require("../services");
30
- class ProjectService {
31
- constructor(di) {
32
- this.appConfigService = di.resolveService(services_1.AppConfigService);
33
- this.appEventsService = di.resolveService(services_1.AppEventsService);
34
- this.dockerService = di.resolveService(services_1.DockerService);
40
+ let ProjectService = class ProjectService {
41
+ constructor(appConfigService, appEventsService, dockerService) {
42
+ this.appConfigService = appConfigService;
43
+ this.appEventsService = appEventsService;
44
+ this.dockerService = dockerService;
45
+ }
46
+ fromObject(data) {
47
+ return new class extends core_1.Project {
48
+ constructor(projectService, data) {
49
+ super(data);
50
+ this.projectService = projectService;
51
+ }
52
+ async save() {
53
+ await this.projectService.save(this);
54
+ }
55
+ }(this, data);
56
+ }
57
+ async getById(id) {
58
+ const data = await makes_1.FS.readJSON(this.appConfigService.dataPath("projects", id, "config.json"));
59
+ return this.fromObject(data);
35
60
  }
36
61
  async cdProject(name) {
37
- const project = await makes_1.Project.searchOne({
62
+ const project = await this.searchOne({
38
63
  name
39
64
  });
40
65
  if (!project) {
@@ -43,7 +68,7 @@ class ProjectService {
43
68
  this.appConfigService.setPWD(project.path);
44
69
  }
45
70
  async get() {
46
- const project = await makes_1.Project.searchOne({
71
+ const project = await this.searchOne({
47
72
  path: this.appConfigService.getPWD()
48
73
  });
49
74
  if (!project) {
@@ -55,15 +80,15 @@ class ProjectService {
55
80
  const project = await this.get();
56
81
  return this.dockerService.getContainer(project.containerName);
57
82
  }
58
- async start() {
83
+ async start(restart) {
59
84
  const project = await this.get();
60
85
  if (project.type === "dockerfile") {
61
86
  project.imageName = `project-${project.name}:develop`;
62
- const images = await makes_1.Docker.imageLs({
87
+ const images = await this.dockerService.imageLs({
63
88
  tag: project.imageName
64
89
  });
65
90
  if (images.length === 0) {
66
- await makes_1.Docker.imageBuild2({
91
+ await this.dockerService.buildImage({
67
92
  tag: project.imageName,
68
93
  context: this.appConfigService.getPWD(),
69
94
  src: project.dockerfile
@@ -72,8 +97,12 @@ class ProjectService {
72
97
  }
73
98
  await this.appEventsService.emit("project:beforeStart", project);
74
99
  let container = await this.dockerService.getContainer(project.containerName);
100
+ if (container && restart) {
101
+ container = null;
102
+ await this.dockerService.removeContainer(project.containerName);
103
+ }
75
104
  if (!container) {
76
- container = await makes_1.Docker.createContainer({
105
+ container = await this.dockerService.createContainer({
77
106
  name: project.containerName,
78
107
  image: project.imageName,
79
108
  env: {
@@ -88,24 +117,20 @@ class ProjectService {
88
117
  ports: project.ports || []
89
118
  });
90
119
  }
91
- else {
92
- process.stdout.write("Container already exists\n");
93
- }
94
- if (container) {
95
- const { State: { Status } } = await container.inspect();
96
- if (Status === "created" || Status === "exited") {
97
- await container.start();
98
- await this.appEventsService.emit("project:start", project);
99
- }
120
+ const { State: { Status } } = await container.inspect();
121
+ if (Status === "created" || Status === "exited") {
122
+ await container.start();
123
+ await this.appEventsService.emit("project:start", project);
100
124
  }
101
125
  }
102
126
  async stop() {
103
127
  const project = await this.get();
104
- const container = await makes_1.Docker.getContainer(project.containerName);
105
- if (container) {
106
- await this.appEventsService.emit("project:stop", project);
107
- await makes_1.Docker.removeContainer(`${project.name}.workspace`);
128
+ const container = await this.dockerService.getContainer(project.containerName);
129
+ if (!container) {
130
+ return;
108
131
  }
132
+ await this.appEventsService.emit("project:stop", project);
133
+ await this.dockerService.removeContainer(project.containerName);
109
134
  }
110
135
  async save(project) {
111
136
  if (!project.name) {
@@ -138,17 +163,23 @@ class ProjectService {
138
163
  if (path && config.src !== path) {
139
164
  continue;
140
165
  }
141
- const projectData = await makes_1.FS.readJSON(this.appConfigService.dataPath("projects", config.id, "config.json"));
142
- if (name && projectData.name !== name) {
166
+ const project = await this.getById(config.id);
167
+ if (name && project.name !== name) {
143
168
  continue;
144
169
  }
145
- const project = makes_1.Project.fromObject({
146
- id: config.id,
147
- ...projectData
148
- });
149
170
  projects.push(project);
150
171
  }
151
172
  return projects;
152
173
  }
153
- }
174
+ async searchOne(params = {}) {
175
+ const [project] = await this.search(params);
176
+ return project || null;
177
+ }
178
+ };
154
179
  exports.ProjectService = ProjectService;
180
+ exports.ProjectService = ProjectService = __decorate([
181
+ (0, core_1.Injectable)("PROJECT_SERVICE"),
182
+ __metadata("design:paramtypes", [services_1.AppConfigService,
183
+ services_1.AppEventsService,
184
+ services_1.DockerService])
185
+ ], ProjectService);
@@ -1,2 +1,2 @@
1
- import { Config } from "../types";
2
- export declare const getConfig: () => Promise<Config>;
1
+ import { AppConfig } from "@wocker/core";
2
+ export declare const getConfig: () => Promise<AppConfig>;
@@ -1,5 +1,4 @@
1
1
  export * from "./buildOptions";
2
- export * from "./demuxOutput";
3
2
  export * from "./escapeRegExp";
4
3
  export * from "./exec";
5
4
  export * from "./fetch";
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./buildOptions"), exports);
18
- __exportStar(require("./demuxOutput"), exports);
19
18
  __exportStar(require("./escapeRegExp"), exports);
20
19
  __exportStar(require("./exec"), exports);
21
20
  __exportStar(require("./fetch"), exports);
@@ -1,2 +1,2 @@
1
- import { Config } from "../types";
2
- export declare const setConfig: (data: Partial<Config>) => Promise<Config>;
1
+ import { AppConfig } from "@wocker/core";
2
+ export declare const setConfig: (data: Partial<AppConfig>) => Promise<AppConfig>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wocker/ws",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "author": "Kris Papercut <krispcut@gmail.com>",
5
5
  "description": "Docker workspace for web projects",
6
6
  "license": "MIT",
@@ -25,9 +25,9 @@
25
25
  "lint": "eslint \"**/*.{js,jsx,ts,tsx}\""
26
26
  },
27
27
  "dependencies": {
28
- "@kearisp/cli": "^1.0.6",
29
- "@wocker/core": "^1.0.4",
30
- "@wocker/utils": "^1.0.2",
28
+ "@kearisp/cli": "^1.0.7",
29
+ "@wocker/core": "^1.0.8",
30
+ "@wocker/utils": "^1.0.3",
31
31
  "async-mutex": "^0.4.0",
32
32
  "axios": "^1.6.7",
33
33
  "chalk": "^2.4.2",
@@ -44,7 +44,7 @@
44
44
  "reflect-metadata": "^0.2.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/dockerode": "^3.3.23",
47
+ "@types/dockerode": "3.3.23",
48
48
  "@types/inquirer": "^7.0.0",
49
49
  "@types/jest": "^29.5.12",
50
50
  "@types/lodash": "^4.14.161",
@@ -58,6 +58,6 @@
58
58
  "eslint-plugin-import": "^2.28.1",
59
59
  "eslint-plugin-node": "^11.1.0",
60
60
  "eslint-webpack-plugin": "^3.1.0",
61
- "typescript": "^5.3.3"
61
+ "typescript": "^5.4.2"
62
62
  }
63
63
  }
@@ -33,7 +33,7 @@
33
33
  ]
34
34
  }
35
35
  },
36
- "volumes": [
36
+ "volumeOptions": [
37
37
  "./:/usr/app"
38
38
  ]
39
39
  }
@@ -117,6 +117,7 @@ RUN if [ "$PCNTL_ENABLE" = "true" ]; then \
117
117
  docker-php-ext-enable pcntl; \
118
118
  fi
119
119
 
120
+ # Soap
120
121
  ARG SOAP_ENABLE=false
121
122
  RUN if [ "$SOAP_ENABLE" = "true" ]; then \
122
123
  apt-get update && apt-get install -y \
@@ -125,10 +126,33 @@ RUN if [ "$SOAP_ENABLE" = "true" ]; then \
125
126
  docker-php-ext-enable soap; \
126
127
  fi
127
128
 
129
+ # XDebug
128
130
  ARG XDEBUG_ENABLE=false
129
131
  RUN if [ "$XDEBUG_ENABLE" = "true" ]; then \
130
132
  pecl install xdebug && \
131
133
  docker-php-ext-enable xdebug; \
134
+ fi \
135
+
136
+ # Gettext
137
+ ARG GETTEXT_ENABLE=false
138
+ RUN if [ "$GETTEXT_ENABLE" = "true" ]; then \
139
+ apt-get update && apt-get install -y gettext && \
140
+ docker-php-ext-install -j "$(nproc)" gettext && \
141
+ docker-php-ext-enable gettext; \
142
+ fi
143
+
144
+ # Bcmath
145
+ ARG BCMATH_ENABLE=false
146
+ RUN if [ "$BCMATH_ENABLE" = "true" ]; then \
147
+ docker-php-ext-install -j "$(nproc)" bcmath && \
148
+ docker-php-ext-enable bcmath; \
149
+ fi
150
+
151
+ # Sockets
152
+ ARG SOCKETS_ENABLE=false
153
+ RUN if [ "$SOCKETS_ENABLE" = "true" ]; then \
154
+ docker-php-ext-install sockets && \
155
+ docker-php-ext-enable sockets; \
132
156
  fi
133
157
 
134
158
  #RUN compare-version $PHP_VERSION "7.3" && \
@@ -29,7 +29,10 @@
29
29
  "INTL_ENABLE": "Intl",
30
30
  "PCNTL_ENABLE": "Pcntl",
31
31
  "SOAP_ENABLE": "Soap",
32
- "XDEBUG_ENABLE": "XDebug"
32
+ "XDEBUG_ENABLE": "XDebug",
33
+ "GETTEXT_ENABLE": "GetText",
34
+ "BCMATH_ENABLE": "Bcmath",
35
+ "SOCKETS_ENABLE": "Sockets"
33
36
  }
34
37
  },
35
38
  "COMPOSER_ENABLE": {
@@ -2,20 +2,172 @@ ARG PHP_VERSION
2
2
 
3
3
  FROM php:${PHP_VERSION}-fpm
4
4
 
5
- #RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
5
+ # WS Tools
6
+ ADD ./bin/compare-version /usr/local/bin/compare-version
7
+ RUN chmod +x /usr/local/bin/compare-version
6
8
 
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
9
+ RUN apt-get update --fix-missing -y && \
10
+ apt-get install -y curl git nginx && \
11
+ chown -R www-data:www-data /var/lib/nginx
13
12
 
14
- #ENV WORKDIR /var/www/html
15
- WORKDIR /var/www/html
13
+ # Http
14
+ ARG HTTP_ENABLE=false
15
+ RUN if [ "$HTTP_ENABLE" = "true" ]; then \
16
+ apt-get update && apt-get install -y \
17
+ libpcre3-dev \
18
+ libssl-dev \
19
+ libcurl4-openssl-dev \
20
+ libicu-dev \
21
+ g++ \
22
+ zlib1g-dev && \
23
+ docker-php-ext-install pcntl && \
24
+ pecl install raphf && docker-php-ext-enable raphf && \
25
+ pecl install pecl_http && docker-php-ext-enable http; \
26
+ fi
16
27
 
17
- EXPOSE 9000
28
+ # Mysqli
29
+ ARG MYSQLI_ENABLE=false
30
+ RUN if [ "$MYSQLI_ENABLE" = "true" ]; then \
31
+ docker-php-ext-install -j "$(nproc)" mysqli && \
32
+ docker-php-ext-enable mysqli; \
33
+ fi
34
+
35
+ # pdo
36
+ ARG PDO_MYSQL_ENABLE=false
37
+ RUN if [ "$PDO_MYSQL_ENABLE" = "true" ]; then \
38
+ docker-php-ext-install pdo pdo_mysql && \
39
+ docker-php-ext-enable pdo_mysql; \
40
+ fi
41
+
42
+ # pgsql
43
+ ARG PGSQL_ENABLE=false
44
+ RUN if [ "$PGSQL_ENABLE" = "true" ]; then \
45
+ apt-get install -y libpq-dev && \
46
+ docker-php-ext-install -j "$(nproc)" pgsql pdo_pgsql && \
47
+ docker-php-ext-enable pgsql pdo_pgsql; \
48
+ fi
49
+
50
+ #gd
51
+ ARG GD_ENABLE=false
52
+ RUN if [ "$GD_ENABLE" = "true" ]; then \
53
+ apt-get update && apt-get install -y \
54
+ libfreetype6-dev \
55
+ libjpeg62-turbo-dev \
56
+ libpng-dev && \
57
+ compare-version $PHP_VERSION "7.3" && \
58
+ docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include || \
59
+ docker-php-ext-configure gd --with-freetype --with-jpeg && \
60
+ docker-php-ext-install -j$(nproc) gd && \
61
+ docker-php-ext-install exif; \
62
+ fi
63
+
64
+ # Zip
65
+ ARG ZIP_ENABLE=false
66
+ RUN if [ "$ZIP_ENABLE" = "true" ]; then \
67
+ apt-get install -y libzip-dev zip unzip && \
68
+ docker-php-ext-configure zip && \
69
+ docker-php-ext-install -j "$(nproc)" zip; \
70
+ fi
71
+
72
+ # memcache
73
+ ARG MEMCACHE_ENABLE=false
74
+ RUN if [ "$MEMCACHE_ENABLE" = "true" ]; then \
75
+ apt-get update && apt-get install -y \
76
+ zlib1g-dev \
77
+ libmemcached-dev && \
78
+ pecl install memcache && docker-php-ext-enable memcache; \
79
+ fi
80
+
81
+ # memcached
82
+ ARG MEMCACHED_ENABLE=false
83
+ RUN if [ "$MEMCACHED_ENABLE" = "true" ]; then \
84
+ apt-get update && apt-get install -y \
85
+ libcurl4-openssl-dev \
86
+ libssl-dev \
87
+ libmemcached-dev \
88
+ zlib1g-dev && \
89
+ pecl install memcached && docker-php-ext-enable memcached; \
90
+ fi
91
+
92
+ # Intl
93
+ ARG INTL_ENABLE=false
94
+ RUN if [ "$INTL_ENABLE" = "true" ]; then \
95
+ apt-get update && apt-get install -y \
96
+ libicu-dev && \
97
+ docker-php-ext-configure intl && \
98
+ docker-php-ext-install intl; \
99
+ fi
100
+
101
+ # Pcntl
102
+ ARG PCNTL_ENABLE=false
103
+ RUN if [ "$PCNTL_ENABLE" = "true" ]; then \
104
+ docker-php-ext-install pcntl && \
105
+ docker-php-ext-enable pcntl; \
106
+ fi
107
+
108
+ # Soap
109
+ ARG SOAP_ENABLE=false
110
+ RUN if [ "$SOAP_ENABLE" = "true" ]; then \
111
+ apt-get update && apt-get install -y \
112
+ libxml2-dev && \
113
+ docker-php-ext-install soap && \
114
+ docker-php-ext-enable soap; \
115
+ fi
18
116
 
117
+ # XDebug
118
+ ARG XDEBUG_ENABLE=false
119
+ RUN if [ "$XDEBUG_ENABLE" = "true" ]; then \
120
+ pecl install xdebug && \
121
+ docker-php-ext-enable xdebug; \
122
+ fi
123
+
124
+ # Gettext
125
+ ARG GETTEXT_ENABLE=false
126
+ RUN if [ "$GETTEXT_ENABLE" = "true" ]; then \
127
+ apt-get update && apt-get install -y gettext && \
128
+ docker-php-ext-install -j "$(nproc)" gettext && \
129
+ docker-php-ext-enable gettext; \
130
+ fi
131
+
132
+ # Bcmath
133
+ ARG BCMATH_ENABLE=false
134
+ RUN if [ "$BCMATH_ENABLE" = "true" ]; then \
135
+ docker-php-ext-install -j "$(nproc)" bcmath && \
136
+ docker-php-ext-enable bcmath; \
137
+ fi
138
+
139
+ # Sockets
140
+ ARG SOCKETS_ENABLE=false
141
+ RUN if [ "$SOCKETS_ENABLE" = "true" ]; then \
142
+ docker-php-ext-install sockets && \
143
+ docker-php-ext-enable sockets; \
144
+ fi
145
+
146
+ # Composer
147
+ ARG COMPOSER_ENABLE=false
148
+
149
+ SHELL ["/bin/bash", "-c"]
150
+ RUN if [ "$COMPOSER_ENABLE" = "true" ]; then \
151
+ apt-get update && \
152
+ apt-get install -y bash-completion; \
153
+ echo "source /etc/bash_completion" >> /home/$USER/.bashrc; \
154
+ mkdir -p /home/$USER/.composer; \
155
+ curl -sL https://getcomposer.org/installer | php && \
156
+ mv composer.phar /usr/local/bin/composer && \
157
+ chmod +x /usr/local/bin/composer; \
158
+ echo ". <(composer completion bash)" >> /home/$USER/.bashrc; \
159
+ fi
160
+ SHELL ["/bin/sh", "-c"]
161
+
162
+ ARG WORKDIR=/var/www
163
+ ARG NGINX_DOCUMENT_ROOT=/var/www
164
+ WORKDIR $WORKDIR
165
+
166
+ ADD etc/nginx/sites-available/default.conf /tmp/default.conf.txt
167
+ RUN envsubst '\${NGINX_DOCUMENT_ROOT}' < /tmp/default.conf.txt > /etc/nginx/sites-available/default
168
+
169
+ EXPOSE 80
170
+ EXPOSE 9000
19
171
 
20
- #ENTRYPOINT ["docker-entrypoint"]
21
- CMD ["php-fpm"]
172
+ #CMD ["nginx", "-g", "daemon off;"]
173
+ CMD service nginx start && php-fpm
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ printf '%s\n%s\n' "$2" "$1" | sort --check=quiet --version-sort
@@ -10,16 +10,45 @@
10
10
  "8.1",
11
11
  "8.2"
12
12
  ]
13
- }
14
- },
15
- "envOptions": {
13
+ },
14
+ "EXTENSIONS": {
15
+ "type": "select",
16
+ "multiple": true,
17
+ "message": "Extensions",
18
+ "options": {
19
+ "MYSQLI_ENABLE": "Mysqli",
20
+ "PDO_MYSQL_ENABLE": "PDO",
21
+ "PGSQL_ENABLE": "Pgsql",
22
+ "GD_ENABLE": "GD",
23
+ "ZIP_ENABLE": "Zip",
24
+ "MEMCACHE_ENABLE": "Memcache",
25
+ "MEMCACHED_ENABLE": "Memcached",
26
+ "HTTP_ENABLE": "Raphf+Http",
27
+ "INTL_ENABLE": "Intl",
28
+ "PCNTL_ENABLE": "Pcntl",
29
+ "SOAP_ENABLE": "Soap",
30
+ "XDEBUG_ENABLE": "XDebug",
31
+ "GETTEXT_ENABLE": "GetText",
32
+ "BCMATH_ENABLE": "Bcmath",
33
+ "SOCKETS_ENABLE": "Sockets"
34
+ }
35
+ },
36
+ "COMPOSER_ENABLE": {
37
+ "message": "Install composer?",
38
+ "type": "boolean"
39
+ },
16
40
  "WORKDIR": {
17
41
  "type": "string",
18
42
  "message": "Workdir",
19
- "default": "/var/www/html"
43
+ "default": "/var/www"
44
+ },
45
+ "NGINX_DOCUMENT_ROOT": {
46
+ "type": "string",
47
+ "message": "Nginx document root",
48
+ "default": "/var/www"
20
49
  }
21
50
  },
22
51
  "volumeOptions": [
23
- "./:/var/www/html"
52
+ "./:/var/www"
24
53
  ]
25
54
  }
@@ -0,0 +1,36 @@
1
+ server {
2
+ listen 80 default_server;
3
+ root ${NGINX_DOCUMENT_ROOT};
4
+
5
+ index index.php index.html index.htm;
6
+
7
+ server_name _;
8
+
9
+ if ($request_uri ~ "index\.(php|htm|html|asp|cfm|jsp)") {
10
+ rewrite ^(.*/).*$ $1 permanent;
11
+ }
12
+
13
+ location / {
14
+ try_files $uri $uri/ @rew;
15
+ }
16
+
17
+ location @rew {
18
+ rewrite ^(.*)$ /index.php last;
19
+ }
20
+
21
+ location ~ \.php$ {
22
+ include fastcgi.conf;
23
+ include fastcgi_params;
24
+ fastcgi_read_timeout 30s;
25
+ try_files $uri /index.php;
26
+ fastcgi_param SCRIPT_FILENAME $request_filename;
27
+ fastcgi_pass 127.0.0.1:9000;
28
+ }
29
+
30
+ # deny access to .htaccess files, if Apache's document root
31
+ # concurs with nginx's one
32
+ #
33
+ location ~ /\.(ht|env|git|ide)* {
34
+ return 404;
35
+ }
36
+ }
@@ -1 +0,0 @@
1
- export declare const Inject: () => (target: any) => void;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Inject = void 0;
4
- const Inject = () => {
5
- return (target) => {
6
- };
7
- };
8
- exports.Inject = Inject;
@@ -1,4 +0,0 @@
1
- import { DI } from "../makes";
2
- export declare const Injectable: () => <T extends new (...rest: any[]) => {}>(Target: T) => {
3
- new (di: DI): {};
4
- } & T;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Injectable = void 0;
4
- const Injectable = () => {
5
- return (Target) => {
6
- return class extends Target {
7
- constructor(di) {
8
- const types = Reflect.getMetadata("design:paramtypes", Target);
9
- const params = types.map((type) => {
10
- return (di).resolveService(type);
11
- });
12
- super(...params);
13
- }
14
- };
15
- };
16
- };
17
- exports.Injectable = Injectable;
@@ -1 +0,0 @@
1
- export * from "./Injectable";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Injectable"), exports);
@@ -1,5 +0,0 @@
1
- import { Cli } from "@kearisp/cli";
2
- declare class Controller {
3
- install(cli: Cli): void;
4
- }
5
- export { Controller };