@wocker/ws 1.0.23 → 1.0.24
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.
- package/lib/{AppModule.d.ts → RootModule.d.ts} +1 -1
- package/lib/{AppModule.js → RootModule.js} +32 -30
- package/lib/controllers/DebugController.d.ts +1 -2
- package/lib/controllers/DebugController.js +4 -6
- package/lib/controllers/ExperimentalController.d.ts +1 -1
- package/lib/controllers/ExperimentalController.js +1 -2
- package/lib/controllers/PluginController.d.ts +1 -1
- package/lib/controllers/PluginController.js +1 -2
- package/lib/controllers/ProjectController.d.ts +7 -10
- package/lib/controllers/ProjectController.js +64 -202
- package/lib/controllers/index.d.ts +0 -1
- package/lib/controllers/index.js +0 -1
- package/lib/env.d.ts +2 -2
- package/lib/env.js +3 -3
- package/lib/main.js +5 -9
- package/lib/makes/index.d.ts +0 -1
- package/lib/makes/index.js +0 -1
- package/lib/modules/app/index.js +17 -1
- package/lib/modules/docker/index.d.ts +2 -2
- package/lib/modules/docker/index.js +5 -5
- package/lib/modules/docker/services/DockerService.d.ts +2 -2
- package/lib/modules/docker/services/DockerService.js +5 -5
- package/lib/modules/docker/services/ModemService.d.ts +1 -0
- package/lib/modules/docker/services/ModemService.js +1 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +3 -0
- package/lib/modules/keystore/controllers/KeystoreController.d.ts +1 -1
- package/lib/modules/keystore/controllers/KeystoreController.js +1 -2
- package/lib/modules/keystore/providers/FileKeystoreProvider.d.ts +3 -4
- package/lib/modules/keystore/providers/FileKeystoreProvider.js +4 -5
- package/lib/modules/keystore/services/KeystoreService.d.ts +4 -3
- package/lib/modules/keystore/services/KeystoreService.js +9 -6
- package/lib/modules/preset/controllers/PresetController.d.ts +18 -0
- package/lib/modules/preset/controllers/PresetController.js +157 -0
- package/lib/modules/preset/controllers/PresetListener.d.ts +14 -0
- package/lib/modules/preset/controllers/PresetListener.js +140 -0
- package/lib/modules/preset/index.d.ts +5 -0
- package/lib/modules/preset/index.js +39 -0
- package/lib/modules/preset/repositories/PresetRepository.d.ts +16 -0
- package/lib/{repositories → modules/preset/repositories}/PresetRepository.js +9 -11
- package/lib/{services → modules/preset/services}/PresetService.d.ts +4 -12
- package/lib/{services → modules/preset/services}/PresetService.js +20 -24
- package/lib/modules/project/controllers/ProjectController.d.ts +13 -0
- package/lib/modules/project/controllers/ProjectController.js +127 -0
- package/lib/modules/project/index.d.ts +5 -0
- package/lib/modules/project/index.js +39 -0
- package/lib/modules/project/repositories/ProjectRepository.d.ts +13 -0
- package/lib/modules/project/repositories/ProjectRepository.js +90 -0
- package/lib/modules/project/services/ProjectService.d.ts +21 -0
- package/lib/modules/project/services/ProjectService.js +211 -0
- package/lib/modules/proxy/controllers/CertController.d.ts +1 -1
- package/lib/modules/proxy/controllers/CertController.js +2 -2
- package/lib/modules/proxy/controllers/ProxyController.d.ts +4 -6
- package/lib/modules/proxy/controllers/ProxyController.js +9 -11
- package/lib/modules/proxy/index.js +3 -1
- package/lib/modules/proxy/services/CertService.d.ts +3 -4
- package/lib/modules/proxy/services/CertService.js +5 -6
- package/lib/modules/proxy/services/ProxyService.d.ts +3 -3
- package/lib/modules/proxy/services/ProxyService.js +14 -15
- package/lib/services/PluginService.d.ts +1 -3
- package/lib/services/PluginService.js +9 -13
- package/package.json +5 -5
- package/lib/controllers/PresetController.d.ts +0 -27
- package/lib/controllers/PresetController.js +0 -364
- package/lib/makes/Logger.d.ts +0 -9
- package/lib/makes/Logger.js +0 -34
- package/lib/repositories/PresetRepository.d.ts +0 -23
- package/lib/repositories/index.d.ts +0 -1
- package/lib/repositories/index.js +0 -17
- package/lib/services/AppConfigService.d.ts +0 -24
- package/lib/services/AppConfigService.js +0 -154
- package/lib/services/AppEventsService.d.ts +0 -9
- package/lib/services/AppEventsService.js +0 -43
- package/lib/services/LogService.d.ts +0 -15
- package/lib/services/LogService.js +0 -67
- package/lib/services/ProjectService.d.ts +0 -27
- package/lib/services/ProjectService.js +0 -206
- package/presets/go/Dockerfile +0 -19
- package/presets/go/config.json +0 -14
- package/presets/php-fpm/Dockerfile +0 -173
- package/presets/php-fpm/bin/compare-version +0 -3
- package/presets/php-fpm/config.json +0 -55
- package/presets/php-fpm/etc/nginx/sites-available/default.conf +0 -36
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FileSystem, LogService as CoreLogService } from "@wocker/core";
|
|
2
|
-
import { AppConfigService } from "./AppConfigService";
|
|
3
|
-
export declare class LogService extends CoreLogService {
|
|
4
|
-
protected readonly appConfigService: AppConfigService;
|
|
5
|
-
constructor(appConfigService: AppConfigService);
|
|
6
|
-
protected get fs(): FileSystem;
|
|
7
|
-
protected get logName(): string;
|
|
8
|
-
debug(...data: any[]): void;
|
|
9
|
-
log(...data: any[]): void;
|
|
10
|
-
info(...data: any[]): void;
|
|
11
|
-
warn(...data: any[]): void;
|
|
12
|
-
error(...data: any[]): void;
|
|
13
|
-
clear(): void;
|
|
14
|
-
protected _log(type: string, ...data: any[]): void;
|
|
15
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.LogService = void 0;
|
|
16
|
-
const core_1 = require("@wocker/core");
|
|
17
|
-
const format_1 = __importDefault(require("date-fns/format"));
|
|
18
|
-
const makes_1 = require("../makes");
|
|
19
|
-
const AppConfigService_1 = require("./AppConfigService");
|
|
20
|
-
let LogService = class LogService extends core_1.LogService {
|
|
21
|
-
constructor(appConfigService) {
|
|
22
|
-
super();
|
|
23
|
-
this.appConfigService = appConfigService;
|
|
24
|
-
makes_1.Logger.install(this);
|
|
25
|
-
}
|
|
26
|
-
get fs() {
|
|
27
|
-
return this.appConfigService.fs;
|
|
28
|
-
}
|
|
29
|
-
get logName() {
|
|
30
|
-
return "ws.log";
|
|
31
|
-
}
|
|
32
|
-
debug(...data) {
|
|
33
|
-
this._log("debug", ...data);
|
|
34
|
-
}
|
|
35
|
-
log(...data) {
|
|
36
|
-
this._log("log", ...data);
|
|
37
|
-
}
|
|
38
|
-
info(...data) {
|
|
39
|
-
this._log("info", ...data);
|
|
40
|
-
}
|
|
41
|
-
warn(...data) {
|
|
42
|
-
this._log("warn", ...data);
|
|
43
|
-
}
|
|
44
|
-
error(...data) {
|
|
45
|
-
this._log("error", ...data);
|
|
46
|
-
}
|
|
47
|
-
clear() {
|
|
48
|
-
this.fs.writeFile(this.logName, "");
|
|
49
|
-
}
|
|
50
|
-
_log(type, ...data) {
|
|
51
|
-
if (type === "debug" && !this.appConfigService.config.debug) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const time = (0, format_1.default)(new Date(), "yyyy-MM-dd HH:mm:ss"), logData = data.map((item) => {
|
|
55
|
-
return typeof item !== "string" ? JSON.stringify(item) : item;
|
|
56
|
-
}).join(" ");
|
|
57
|
-
if (!this.fs.exists(this.logName)) {
|
|
58
|
-
this.fs.writeFile(this.logName, "");
|
|
59
|
-
}
|
|
60
|
-
this.fs.appendFile(this.logName, `[${time}] ${type}: ${logData}\n`);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
exports.LogService = LogService;
|
|
64
|
-
exports.LogService = LogService = __decorate([
|
|
65
|
-
(0, core_1.Injectable)("LOG_SERVICE"),
|
|
66
|
-
__metadata("design:paramtypes", [AppConfigService_1.AppConfigService])
|
|
67
|
-
], LogService);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Project, ProjectProperties } from "@wocker/core";
|
|
2
|
-
import { DockerService } from "../modules/docker";
|
|
3
|
-
import { KeystoreService } from "../modules/keystore";
|
|
4
|
-
import { AppConfigService } from "./AppConfigService";
|
|
5
|
-
import { AppEventsService } from "./AppEventsService";
|
|
6
|
-
type SearchParams = Partial<{
|
|
7
|
-
name: string;
|
|
8
|
-
path: string;
|
|
9
|
-
}>;
|
|
10
|
-
export declare class ProjectService {
|
|
11
|
-
protected readonly appConfigService: AppConfigService;
|
|
12
|
-
protected readonly appEventsService: AppEventsService;
|
|
13
|
-
protected readonly keystoreService: KeystoreService;
|
|
14
|
-
protected readonly dockerService: DockerService;
|
|
15
|
-
constructor(appConfigService: AppConfigService, appEventsService: AppEventsService, keystoreService: KeystoreService, dockerService: DockerService);
|
|
16
|
-
fromObject(data: Partial<ProjectProperties>): Project;
|
|
17
|
-
get(name?: string): Project;
|
|
18
|
-
getById(id: string): Project;
|
|
19
|
-
cdProject(name: string): void;
|
|
20
|
-
start(project: Project, restart?: boolean, rebuild?: boolean): Promise<void>;
|
|
21
|
-
stop(project: Project): Promise<void>;
|
|
22
|
-
save(project: Project): void;
|
|
23
|
-
search(params?: Partial<SearchParams>): Project[];
|
|
24
|
-
searchOne(params?: Partial<SearchParams>): Project | null;
|
|
25
|
-
logs(detach?: boolean): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ProjectService = void 0;
|
|
13
|
-
const core_1 = require("@wocker/core");
|
|
14
|
-
const docker_1 = require("../modules/docker");
|
|
15
|
-
const keystore_1 = require("../modules/keystore");
|
|
16
|
-
const AppConfigService_1 = require("./AppConfigService");
|
|
17
|
-
const AppEventsService_1 = require("./AppEventsService");
|
|
18
|
-
let ProjectService = class ProjectService {
|
|
19
|
-
constructor(appConfigService, appEventsService, keystoreService, dockerService) {
|
|
20
|
-
this.appConfigService = appConfigService;
|
|
21
|
-
this.appEventsService = appEventsService;
|
|
22
|
-
this.keystoreService = keystoreService;
|
|
23
|
-
this.dockerService = dockerService;
|
|
24
|
-
}
|
|
25
|
-
fromObject(data) {
|
|
26
|
-
const _this = this;
|
|
27
|
-
return new class extends core_1.Project {
|
|
28
|
-
constructor(data) {
|
|
29
|
-
super(data);
|
|
30
|
-
}
|
|
31
|
-
async getSecret(key, defaultValue) {
|
|
32
|
-
return _this.keystoreService.get(`p:${this.name}:${key}`, defaultValue);
|
|
33
|
-
}
|
|
34
|
-
async setSecret(key, value) {
|
|
35
|
-
return _this.keystoreService.set(`p:${this.name}:${key}`, value);
|
|
36
|
-
}
|
|
37
|
-
save() {
|
|
38
|
-
_this.save(this);
|
|
39
|
-
}
|
|
40
|
-
}(data);
|
|
41
|
-
}
|
|
42
|
-
get(name) {
|
|
43
|
-
const project = name
|
|
44
|
-
? this.searchOne({ name })
|
|
45
|
-
: this.searchOne({
|
|
46
|
-
path: this.appConfigService.pwd()
|
|
47
|
-
});
|
|
48
|
-
if (!project) {
|
|
49
|
-
throw new Error("Project not found");
|
|
50
|
-
}
|
|
51
|
-
if (name) {
|
|
52
|
-
this.appConfigService.setPWD(project.path);
|
|
53
|
-
}
|
|
54
|
-
return project;
|
|
55
|
-
}
|
|
56
|
-
getById(id) {
|
|
57
|
-
const projectData = this.appConfigService.config.getProject(id);
|
|
58
|
-
const data = this.appConfigService.fs.readJSON("projects", id, "config.json");
|
|
59
|
-
return this.fromObject({
|
|
60
|
-
...data,
|
|
61
|
-
path: projectData.path
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
cdProject(name) {
|
|
65
|
-
const project = this.searchOne({
|
|
66
|
-
name
|
|
67
|
-
});
|
|
68
|
-
if (!project) {
|
|
69
|
-
throw new Error("Project not found");
|
|
70
|
-
}
|
|
71
|
-
this.appConfigService.setPWD(project.path);
|
|
72
|
-
}
|
|
73
|
-
async start(project, restart, rebuild) {
|
|
74
|
-
let container = await this.dockerService.getContainer(project.containerName);
|
|
75
|
-
if (container && (restart || rebuild)) {
|
|
76
|
-
container = null;
|
|
77
|
-
await this.appEventsService.emit("project:stop", project);
|
|
78
|
-
await this.dockerService.removeContainer(project.containerName);
|
|
79
|
-
}
|
|
80
|
-
if (!container) {
|
|
81
|
-
if (project.type === core_1.PROJECT_TYPE_DOCKERFILE) {
|
|
82
|
-
project.imageName = `project-${project.name}:develop`;
|
|
83
|
-
if (rebuild) {
|
|
84
|
-
await this.dockerService.imageRm(project.imageName);
|
|
85
|
-
}
|
|
86
|
-
const images = await this.dockerService.imageLs({
|
|
87
|
-
tag: project.imageName
|
|
88
|
-
});
|
|
89
|
-
if (images.length === 0) {
|
|
90
|
-
await this.dockerService.buildImage({
|
|
91
|
-
tag: project.imageName,
|
|
92
|
-
buildArgs: project.buildArgs,
|
|
93
|
-
context: this.appConfigService.pwd(),
|
|
94
|
-
src: project.dockerfile
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (rebuild) {
|
|
99
|
-
await this.appEventsService.emit("project:rebuild", project);
|
|
100
|
-
}
|
|
101
|
-
await this.appEventsService.emit("project:beforeStart", project);
|
|
102
|
-
const config = this.appConfigService.getConfig();
|
|
103
|
-
container = await this.dockerService.createContainer({
|
|
104
|
-
name: project.containerName,
|
|
105
|
-
image: project.imageName,
|
|
106
|
-
env: {
|
|
107
|
-
...config.env || {},
|
|
108
|
-
...project.env || {}
|
|
109
|
-
},
|
|
110
|
-
ports: project.ports || [],
|
|
111
|
-
volumes: (project.volumes || []).map((volume) => {
|
|
112
|
-
const regVolume = /^([^:]+):([^:]+)(?::([^:]+))?$/;
|
|
113
|
-
const [, source, destination, options] = regVolume.exec(volume);
|
|
114
|
-
if (source.startsWith("/")) {
|
|
115
|
-
return volume;
|
|
116
|
-
}
|
|
117
|
-
return `${this.appConfigService.pwd(source)}:${destination}` + (options ? `:${options}` : "");
|
|
118
|
-
}),
|
|
119
|
-
extraHosts: Object.keys(project.extraHosts || {}).map((host) => {
|
|
120
|
-
return `${project.extraHosts[host]}:${host}`;
|
|
121
|
-
})
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
const { State: { Status } } = await container.inspect();
|
|
125
|
-
if (Status === "created" || Status === "exited") {
|
|
126
|
-
await container.start();
|
|
127
|
-
}
|
|
128
|
-
await this.appEventsService.emit("project:start", project);
|
|
129
|
-
}
|
|
130
|
-
async stop(project) {
|
|
131
|
-
const container = await this.dockerService.getContainer(project.containerName);
|
|
132
|
-
if (!container) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
await this.appEventsService.emit("project:stop", project);
|
|
136
|
-
await this.dockerService.removeContainer(project.containerName);
|
|
137
|
-
}
|
|
138
|
-
save(project) {
|
|
139
|
-
if (!project.name) {
|
|
140
|
-
throw new Error("Project should has a name");
|
|
141
|
-
}
|
|
142
|
-
if (!project.path) {
|
|
143
|
-
throw new Error("Project should has a path");
|
|
144
|
-
}
|
|
145
|
-
if (!project.id) {
|
|
146
|
-
project.id = project.name;
|
|
147
|
-
}
|
|
148
|
-
if (!this.appConfigService.fs.exists(`projects/${project.id}`)) {
|
|
149
|
-
this.appConfigService.fs.mkdir(`projects/${project.id}`, {
|
|
150
|
-
recursive: true
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
const { path, ...rest } = project.toJSON();
|
|
154
|
-
this.appConfigService.addProject(project.id, project.name, path);
|
|
155
|
-
this.appConfigService.fs.writeJSON(`projects/${project.id}/config.json`, rest);
|
|
156
|
-
this.appConfigService.save();
|
|
157
|
-
}
|
|
158
|
-
search(params = {}) {
|
|
159
|
-
const { name, path } = params;
|
|
160
|
-
const projects = [];
|
|
161
|
-
for (const projectRef of this.appConfigService.projects || []) {
|
|
162
|
-
if (name && projectRef.name !== name) {
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
if (path && projectRef.path !== path) {
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
const project = this.getById(projectRef.name);
|
|
169
|
-
if (name && project.name !== name) {
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
projects.push(project);
|
|
173
|
-
}
|
|
174
|
-
return projects;
|
|
175
|
-
}
|
|
176
|
-
searchOne(params = {}) {
|
|
177
|
-
const [project] = this.search(params);
|
|
178
|
-
return project || null;
|
|
179
|
-
}
|
|
180
|
-
async logs(detach) {
|
|
181
|
-
const project = this.get();
|
|
182
|
-
const container = await this.dockerService.getContainer(project.containerName);
|
|
183
|
-
if (!container) {
|
|
184
|
-
throw new Error("Project not started");
|
|
185
|
-
}
|
|
186
|
-
if (!detach) {
|
|
187
|
-
await this.dockerService.logs(container);
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
const data = await container.logs({
|
|
191
|
-
stdout: true,
|
|
192
|
-
stderr: true,
|
|
193
|
-
follow: false
|
|
194
|
-
});
|
|
195
|
-
process.stdout.write(data);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
exports.ProjectService = ProjectService;
|
|
200
|
-
exports.ProjectService = ProjectService = __decorate([
|
|
201
|
-
(0, core_1.Injectable)("PROJECT_SERVICE"),
|
|
202
|
-
__metadata("design:paramtypes", [AppConfigService_1.AppConfigService,
|
|
203
|
-
AppEventsService_1.AppEventsService,
|
|
204
|
-
keystore_1.KeystoreService,
|
|
205
|
-
docker_1.DockerService])
|
|
206
|
-
], ProjectService);
|
package/presets/go/Dockerfile
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
FROM golang:latest
|
|
2
|
-
|
|
3
|
-
ENV GO_RUN "go run main.go"
|
|
4
|
-
|
|
5
|
-
WORKDIR /usr/app
|
|
6
|
-
|
|
7
|
-
# -----
|
|
8
|
-
RUN apt-get update
|
|
9
|
-
RUN apt-get install -y \
|
|
10
|
-
xvfb \
|
|
11
|
-
libfontconfig \
|
|
12
|
-
wkhtmltopdf
|
|
13
|
-
# -----
|
|
14
|
-
|
|
15
|
-
EXPOSE 80
|
|
16
|
-
|
|
17
|
-
CMD go mod download && \
|
|
18
|
-
# go get github.com/loov/watchrun && \
|
|
19
|
-
${GO_RUN}
|
package/presets/go/config.json
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
ARG PHP_VERSION
|
|
2
|
-
|
|
3
|
-
FROM php:${PHP_VERSION}-fpm
|
|
4
|
-
|
|
5
|
-
# WS Tools
|
|
6
|
-
ADD ./bin/compare-version /usr/local/bin/compare-version
|
|
7
|
-
RUN chmod +x /usr/local/bin/compare-version
|
|
8
|
-
|
|
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
|
|
12
|
-
|
|
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
|
|
27
|
-
|
|
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
|
|
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
|
|
171
|
-
|
|
172
|
-
#CMD ["nginx", "-g", "daemon off;"]
|
|
173
|
-
CMD service nginx start && php-fpm
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "php-fpm",
|
|
3
|
-
"dockerfile": "./Dockerfile",
|
|
4
|
-
"buildArgsOptions": {
|
|
5
|
-
"PHP_VERSION": {
|
|
6
|
-
"message": "PHP version",
|
|
7
|
-
"type": "select",
|
|
8
|
-
"hash": false,
|
|
9
|
-
"options": [
|
|
10
|
-
"8.0",
|
|
11
|
-
"8.1",
|
|
12
|
-
"8.2"
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
|
-
"EXTENSIONS": {
|
|
16
|
-
"type": "select",
|
|
17
|
-
"multiple": true,
|
|
18
|
-
"message": "Extensions",
|
|
19
|
-
"options": {
|
|
20
|
-
"MYSQLI_ENABLE": "Mysqli",
|
|
21
|
-
"PDO_MYSQL_ENABLE": "PDO",
|
|
22
|
-
"PGSQL_ENABLE": "Pgsql",
|
|
23
|
-
"GD_ENABLE": "GD",
|
|
24
|
-
"ZIP_ENABLE": "Zip",
|
|
25
|
-
"MEMCACHE_ENABLE": "Memcache",
|
|
26
|
-
"MEMCACHED_ENABLE": "Memcached",
|
|
27
|
-
"HTTP_ENABLE": "Raphf+Http",
|
|
28
|
-
"INTL_ENABLE": "Intl",
|
|
29
|
-
"PCNTL_ENABLE": "Pcntl",
|
|
30
|
-
"SOAP_ENABLE": "Soap",
|
|
31
|
-
"XDEBUG_ENABLE": "XDebug",
|
|
32
|
-
"GETTEXT_ENABLE": "GetText",
|
|
33
|
-
"BCMATH_ENABLE": "Bcmath",
|
|
34
|
-
"SOCKETS_ENABLE": "Sockets"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"COMPOSER_ENABLE": {
|
|
38
|
-
"message": "Install composer?",
|
|
39
|
-
"type": "boolean"
|
|
40
|
-
},
|
|
41
|
-
"WORKDIR": {
|
|
42
|
-
"type": "string",
|
|
43
|
-
"message": "Workdir",
|
|
44
|
-
"default": "/var/www"
|
|
45
|
-
},
|
|
46
|
-
"NGINX_DOCUMENT_ROOT": {
|
|
47
|
-
"type": "string",
|
|
48
|
-
"message": "Nginx document root",
|
|
49
|
-
"default": "/var/www"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"volumeOptions": [
|
|
53
|
-
"./:/var/www"
|
|
54
|
-
]
|
|
55
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
}
|