@fishawack/lab-env 1.16.0 → 1.18.1
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/CHANGELOG.md +14 -0
- package/_Test/boilerplate-craftcms.js +29 -0
- package/_Test/boilerplate-drupal.js +3 -3
- package/_Test/boilerplate-laravel.js +3 -3
- package/_Test/boilerplate-wordpress.js +3 -3
- package/_Test/boilerplate.js +3 -3
- package/cli.js +5 -1
- package/commands/artisan.js +1 -1
- package/commands/check.js +2 -2
- package/commands/clean.js +2 -2
- package/commands/craft.js +15 -0
- package/commands/deploy.js +1 -1
- package/commands/docker/build.js +8 -3
- package/commands/docker/rebuild.js +8 -3
- package/commands/docker/volumes.js +3 -3
- package/commands/regenerate.js +2 -2
- package/commands/reinstall.js +1 -1
- package/commands/setup.js +2 -2
- package/commands/start.js +1 -1
- package/craftcms/3/docker-compose.yml +44 -0
- package/craftcms/3/nginx/nginx.conf +37 -0
- package/craftcms/3/php/Dockerfile +17 -0
- package/craftcms/3/php/custom.conf +9 -0
- package/drupal/9/docker-compose.yml +2 -0
- package/drupal/9/php/Dockerfile +9 -0
- package/drupal/9/php/policy.xml +99 -0
- package/globals.js +11 -3
- package/intercept.sh +6 -1
- package/laravel/8/docker-compose.yml +6 -2
- package/laravel/8/php/Dockerfile +17 -0
- package/laravel/8/php/custom.conf +2 -0
- package/laravel/8/php/policy.xml +99 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 1.18.1 (2022-03-30)
|
|
4
|
+
* [Bug] Craftcms now correctly calls reinstall and deploy commands
|
|
5
|
+
|
|
6
|
+
### 1.18.0 (2022-02-28)
|
|
7
|
+
* [Feature] Can now pass container name to rebuild/build commands
|
|
8
|
+
* [Feature] Craftcms now a supported tech stack
|
|
9
|
+
* [Change] Laravel now installs ghostscript and imagemagick by default
|
|
10
|
+
* [Change] Drupal now installs ghostscript and imagemagick by default
|
|
11
|
+
* [Misc] No longer rename clone folders when testing lab-env itself
|
|
12
|
+
|
|
13
|
+
### 1.17.0 (2022-01-27)
|
|
14
|
+
* [Feature] Drupals php image now contains imagemagick and imagick
|
|
15
|
+
* [Change] Drupals php image is now labelled and tagged
|
|
16
|
+
|
|
3
17
|
### 1.16.0 (2022-01-25)
|
|
4
18
|
* [Feature] lab-env now checks if docker process is running. Only `origin` and `--version` commands allowed if not
|
|
5
19
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const repo = `boilerplate-craftcms`;
|
|
4
|
+
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: `_Test/_fixtures/${repo}`};
|
|
5
|
+
|
|
6
|
+
const expect = require('chai').expect;
|
|
7
|
+
const execSync = require('child_process').execSync;
|
|
8
|
+
|
|
9
|
+
describe('deploy', () => {
|
|
10
|
+
before(function(){
|
|
11
|
+
this.timeout(60000 * 10);
|
|
12
|
+
|
|
13
|
+
execSync(`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
|
+
|
|
15
|
+
execSync('fw setup', opts);
|
|
16
|
+
|
|
17
|
+
execSync('fw prod', opts);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it(`All ${repo} tests should pass`, async () => {
|
|
21
|
+
expect(execSync('fw test', opts)).to.not.equal(Error);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
after(() => {
|
|
25
|
+
execSync('fw nuke', opts)
|
|
26
|
+
|
|
27
|
+
execSync(`rm -rf _Test/_fixtures/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const repo = `
|
|
3
|
+
const repo = `boilerplate-drupal`;
|
|
4
4
|
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: `_Test/_fixtures/${repo}`};
|
|
5
5
|
|
|
6
6
|
const expect = require('chai').expect;
|
|
@@ -10,14 +10,14 @@ describe('deploy', () => {
|
|
|
10
10
|
before(function(){
|
|
11
11
|
this.timeout(60000 * 10);
|
|
12
12
|
|
|
13
|
-
execSync(`git clone git@bitbucket.org:fishawackdigital
|
|
13
|
+
execSync(`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
14
|
|
|
15
15
|
execSync('fw setup', opts);
|
|
16
16
|
|
|
17
17
|
execSync('fw prod', opts);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
it(
|
|
20
|
+
it(`All ${repo} tests should pass`, async () => {
|
|
21
21
|
expect(execSync('fw test', opts)).to.not.equal(Error);
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const repo = `
|
|
3
|
+
const repo = `boilerplate-laravel`;
|
|
4
4
|
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: `_Test/_fixtures/${repo}`};
|
|
5
5
|
|
|
6
6
|
const expect = require('chai').expect;
|
|
@@ -10,14 +10,14 @@ describe('deploy', () => {
|
|
|
10
10
|
before(function(){
|
|
11
11
|
this.timeout(60000 * 10);
|
|
12
12
|
|
|
13
|
-
execSync(`git clone git@bitbucket.org:fishawackdigital
|
|
13
|
+
execSync(`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
14
|
|
|
15
15
|
execSync('fw setup', opts);
|
|
16
16
|
|
|
17
17
|
execSync('fw prod', opts);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
it(
|
|
20
|
+
it(`All ${repo} tests should pass`, async () => {
|
|
21
21
|
expect(execSync('fw test', opts)).to.not.equal(Error);
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const repo = `
|
|
3
|
+
const repo = `boilerplate-wordpress`;
|
|
4
4
|
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: `_Test/_fixtures/${repo}`};
|
|
5
5
|
|
|
6
6
|
const expect = require('chai').expect;
|
|
@@ -10,14 +10,14 @@ describe('deploy', () => {
|
|
|
10
10
|
before(function(){
|
|
11
11
|
this.timeout(60000 * 10);
|
|
12
12
|
|
|
13
|
-
execSync(`git clone git@bitbucket.org:fishawackdigital
|
|
13
|
+
execSync(`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
14
|
|
|
15
15
|
execSync('fw setup', opts);
|
|
16
16
|
|
|
17
17
|
execSync('fw prod', opts);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
it(
|
|
20
|
+
it(`All ${repo} tests should pass`, async () => {
|
|
21
21
|
expect(execSync('fw test', opts)).to.not.equal(Error);
|
|
22
22
|
});
|
|
23
23
|
|
package/_Test/boilerplate.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const repo = `
|
|
3
|
+
const repo = `boilerplate`;
|
|
4
4
|
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: `_Test/_fixtures/${repo}`};
|
|
5
5
|
|
|
6
6
|
const expect = require('chai').expect;
|
|
@@ -10,14 +10,14 @@ describe('deploy', () => {
|
|
|
10
10
|
before(function(){
|
|
11
11
|
this.timeout(60000 * 10);
|
|
12
12
|
|
|
13
|
-
execSync(`git clone git@bitbucket.org:fishawackdigital
|
|
13
|
+
execSync(`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
14
|
|
|
15
15
|
execSync('fw setup', opts);
|
|
16
16
|
|
|
17
17
|
execSync('fw prod', opts);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
it(
|
|
20
|
+
it(`All ${repo} tests should pass`, async () => {
|
|
21
21
|
expect(execSync('fw test', opts)).to.not.equal(Error);
|
|
22
22
|
});
|
|
23
23
|
|
package/cli.js
CHANGED
|
@@ -36,12 +36,16 @@ if(!_.services && !(args[0] === 'origin' || args[0] === '--version')) return;
|
|
|
36
36
|
if(_.platform === "laravel"){
|
|
37
37
|
commands.push('artisan');
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
if(_.platform === "craftcms"){
|
|
41
|
+
commands.push('craft');
|
|
42
|
+
}
|
|
39
43
|
|
|
40
44
|
if(_.platform === "drupal"){
|
|
41
45
|
commands.push('drush');
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
48
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
45
49
|
commands.push('composer', 'php');
|
|
46
50
|
}
|
|
47
51
|
|
package/commands/artisan.js
CHANGED
package/commands/check.js
CHANGED
|
@@ -15,8 +15,8 @@ module.exports = [
|
|
|
15
15
|
argv => {
|
|
16
16
|
execSync(`${_.docker} ${_.run}c "check-dependencies ${argv.v ? '' : '&>/dev/null'} && echo -e '\\033[0;32mNpm deps OK\\033[0m' || { echo -e '\\033[0;31mNpm deps missing or outdated\\033[0m'; }"`, _.opts);
|
|
17
17
|
|
|
18
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
18
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
19
19
|
execSync(`${_.docker} ${_.method} php bash -lc "composer install --dry-run ${argv.v ? '' : '2>&1'} | grep -q 'Nothing to install, update or remove' && echo -e '\\033[0;32mComposer deps OK\\033[0m' || echo -e '\\033[0;31mComposer deps missing or outdated\\033[0m'"`, _.opts);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
];
|
|
22
|
+
];
|
package/commands/clean.js
CHANGED
|
@@ -9,8 +9,8 @@ module.exports = [
|
|
|
9
9
|
argv => {
|
|
10
10
|
execSync(`${_.docker} ${_.run}c "git clean -xfd node_modules/ 2>/dev/null || true"`, _.opts);
|
|
11
11
|
|
|
12
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
12
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "git clean -xfd vendor/ 2>/dev/null || true"`, _.opts);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
];
|
|
16
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const _ = require('../globals.js');
|
|
2
|
+
|
|
3
|
+
const execSync = require('child_process').execSync;
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
['craft [command...]', 'craft'],
|
|
7
|
+
'run craft command',
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.positional('command', {
|
|
10
|
+
describe: 'command to run',
|
|
11
|
+
default: ''
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
argv => _.up(() => execSync(`${_.docker} ${_.exec} php bash -lc "php craft ${argv.command.join(' ')}"`, _.opts))
|
|
15
|
+
];
|
package/commands/deploy.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = [
|
|
|
7
7
|
'deploys the repo',
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
|
-
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal"){
|
|
10
|
+
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
11
11
|
_.up(() => execSync(`source ${__dirname}/../intercept.sh && /bin/bash ./_Scripts/deploy.sh`, _.opts));
|
|
12
12
|
} else {
|
|
13
13
|
execSync(`${_.docker} ${_.run}c "xvfb-run npm run deploy"`, _.opts);
|
package/commands/docker/build.js
CHANGED
|
@@ -3,8 +3,13 @@ const _ = require('../../globals.js');
|
|
|
3
3
|
const execSync = require('child_process').execSync;
|
|
4
4
|
|
|
5
5
|
module.exports = [
|
|
6
|
-
'build',
|
|
6
|
+
'build [image]',
|
|
7
7
|
false,
|
|
8
|
-
yargs => {
|
|
9
|
-
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.positional('image', {
|
|
10
|
+
describe: 'image to build',
|
|
11
|
+
default: ''
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
argv => execSync(`${_.docker} build ${argv.image}`, _.opts)
|
|
10
15
|
];
|
|
@@ -3,8 +3,13 @@ const _ = require('../../globals.js');
|
|
|
3
3
|
const execSync = require('child_process').execSync;
|
|
4
4
|
|
|
5
5
|
module.exports = [
|
|
6
|
-
'rebuild',
|
|
6
|
+
'rebuild [image]',
|
|
7
7
|
false,
|
|
8
|
-
yargs => {
|
|
9
|
-
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.positional('image', {
|
|
10
|
+
describe: 'image to rebuild',
|
|
11
|
+
default: ''
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
argv => execSync(`${_.docker} build ${argv.image} --no-cache`, _.opts)
|
|
10
15
|
];
|
|
@@ -9,7 +9,7 @@ module.exports = [
|
|
|
9
9
|
'node_modules'
|
|
10
10
|
];
|
|
11
11
|
|
|
12
|
-
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal"){
|
|
12
|
+
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
volumes.push(
|
|
14
14
|
'mysql'
|
|
15
15
|
);
|
|
@@ -27,7 +27,7 @@ module.exports = [
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
30
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
31
31
|
volumes.push(
|
|
32
32
|
'vendor'
|
|
33
33
|
);
|
|
@@ -35,4 +35,4 @@ module.exports = [
|
|
|
35
35
|
|
|
36
36
|
console.log(`${volumes.map(d => `${_.repo_safe}_${d}`).join('\n')}`);
|
|
37
37
|
}
|
|
38
|
-
];
|
|
38
|
+
];
|
package/commands/regenerate.js
CHANGED
|
@@ -9,8 +9,8 @@ module.exports = [
|
|
|
9
9
|
argv => {
|
|
10
10
|
execSync(`${_.docker} ${_.run}c "rm package-lock.json; git clean -xfd node_modules/ 2>/dev/null || true; npm install"`, _.opts);
|
|
11
11
|
|
|
12
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
12
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "rm composer.lock; git clean -xfd vendor/ 2>/dev/null || true; composer install"`, _.opts)
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
];
|
|
16
|
+
];
|
package/commands/reinstall.js
CHANGED
|
@@ -9,7 +9,7 @@ module.exports = [
|
|
|
9
9
|
argv => {
|
|
10
10
|
execSync(`${_.docker} ${_.run}c "npm ci || npm i"`, _.opts);
|
|
11
11
|
|
|
12
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
12
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "composer install"`, _.opts);
|
|
14
14
|
}
|
|
15
15
|
}
|
package/commands/setup.js
CHANGED
|
@@ -7,10 +7,10 @@ module.exports = [
|
|
|
7
7
|
'runs the initial setup',
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
|
-
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal"){
|
|
10
|
+
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
11
11
|
_.up(() => execSync(`source ${__dirname}/../intercept.sh && /bin/bash ./_Scripts/setup.sh`, _.opts));
|
|
12
12
|
} else {
|
|
13
13
|
execSync(`${_.docker} ${_.run}c "npm run setup"`, _.opts);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
];
|
|
16
|
+
];
|
package/commands/start.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = [
|
|
|
14
14
|
argv => {
|
|
15
15
|
_.ports.get();
|
|
16
16
|
|
|
17
|
-
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal"){
|
|
17
|
+
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
18
18
|
_.up(() => execSync(`${_.docker} ${_.exec} core bash -lc "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts));
|
|
19
19
|
} else {
|
|
20
20
|
execSync(`${_.docker} ${_.run}c "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
services:
|
|
2
|
+
mysql:
|
|
3
|
+
image: mysql:5.7
|
|
4
|
+
networks:
|
|
5
|
+
- default
|
|
6
|
+
environment:
|
|
7
|
+
- MYSQL_ROOT_PASSWORD=password
|
|
8
|
+
- MYSQL_DATABASE=${DB_DATABASE}
|
|
9
|
+
- MYSQL_USER=${DB_USER}
|
|
10
|
+
- MYSQL_PASSWORD=${DB_PASSWORD}
|
|
11
|
+
ports:
|
|
12
|
+
- "${PORT_DB:-3306}:3306"
|
|
13
|
+
volumes:
|
|
14
|
+
- mysql:/var/lib/mysql
|
|
15
|
+
nginx:
|
|
16
|
+
image: nginx:1.19
|
|
17
|
+
networks:
|
|
18
|
+
- default
|
|
19
|
+
volumes:
|
|
20
|
+
- $CWD/:/app
|
|
21
|
+
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
|
|
22
|
+
ports:
|
|
23
|
+
- "${PORT_WEB:-8000}:80"
|
|
24
|
+
php:
|
|
25
|
+
build:
|
|
26
|
+
context: ./php/
|
|
27
|
+
dockerfile: Dockerfile
|
|
28
|
+
image: lab-env/craftcms/3/php:0.0.1
|
|
29
|
+
init: true
|
|
30
|
+
working_dir: /app
|
|
31
|
+
networks:
|
|
32
|
+
- default
|
|
33
|
+
volumes:
|
|
34
|
+
- $CWD/:/app
|
|
35
|
+
- ./php/custom.conf:/opt/bitnami/php/etc/custom.conf
|
|
36
|
+
- vendor:/app/vendor
|
|
37
|
+
networks:
|
|
38
|
+
default:
|
|
39
|
+
driver: "bridge"
|
|
40
|
+
volumes:
|
|
41
|
+
vendor:
|
|
42
|
+
driver: "local"
|
|
43
|
+
mysql:
|
|
44
|
+
driver: "local"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
server {
|
|
2
|
+
listen 80 default_server;
|
|
3
|
+
listen [::]:80 default_server;
|
|
4
|
+
root /app/web;
|
|
5
|
+
|
|
6
|
+
add_header X-Frame-Options "SAMEORIGIN";
|
|
7
|
+
add_header X-XSS-Protection "1; mode=block";
|
|
8
|
+
add_header X-Content-Type-Options "nosniff";
|
|
9
|
+
|
|
10
|
+
index index.php;
|
|
11
|
+
|
|
12
|
+
charset utf-8;
|
|
13
|
+
|
|
14
|
+
location / {
|
|
15
|
+
try_files $uri $uri/ /index.php?$query_string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
location = /favicon.ico { access_log off; log_not_found off; }
|
|
19
|
+
location = /robots.txt { access_log off; log_not_found off; }
|
|
20
|
+
|
|
21
|
+
error_page 404 /index.php;
|
|
22
|
+
|
|
23
|
+
location ~ \.php$ {
|
|
24
|
+
fastcgi_pass php:9000;
|
|
25
|
+
include fastcgi_params;
|
|
26
|
+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
27
|
+
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
location ~ \.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp|pdf|dzi)$ {
|
|
31
|
+
add_header Access-Control-Allow-Origin *;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
location ~ /\.(?!well-known).* {
|
|
35
|
+
deny all;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
FROM chialab/php:7.4-fpm
|
|
2
|
+
|
|
3
|
+
MAINTAINER Mike Mellor
|
|
4
|
+
|
|
5
|
+
# Install mysql client
|
|
6
|
+
RUN apt-get update && \
|
|
7
|
+
apt-get install -y mariadb-client
|
|
8
|
+
|
|
9
|
+
# Install Imagemagick
|
|
10
|
+
RUN apt-get install -y libmagickwand-dev --no-install-recommends
|
|
11
|
+
|
|
12
|
+
# PHP Imagick ext
|
|
13
|
+
RUN pecl install imagick && docker-php-ext-enable imagick
|
|
14
|
+
|
|
15
|
+
# Cleanup apt-get install folders
|
|
16
|
+
RUN apt-get clean && \
|
|
17
|
+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
@@ -33,6 +33,7 @@ services:
|
|
|
33
33
|
build:
|
|
34
34
|
context: ./php/
|
|
35
35
|
dockerfile: Dockerfile
|
|
36
|
+
image: lab-env/drupal/9/php:0.0.2
|
|
36
37
|
init: true
|
|
37
38
|
working_dir: /app
|
|
38
39
|
networks:
|
|
@@ -42,6 +43,7 @@ services:
|
|
|
42
43
|
volumes:
|
|
43
44
|
- $CWD/:/app
|
|
44
45
|
- ./php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
|
|
46
|
+
- ./php/policy.xml:/etc/ImageMagick-6/policy.xml
|
|
45
47
|
- $CWD/themes:/app/web/themes
|
|
46
48
|
- $CWD/modules:/app/web/modules
|
|
47
49
|
- $CWD/sites:/app/web/sites
|
package/drupal/9/php/Dockerfile
CHANGED
|
@@ -6,6 +6,15 @@ MAINTAINER Mike Mellor
|
|
|
6
6
|
RUN apt-get update && \
|
|
7
7
|
apt-get install -y mariadb-client
|
|
8
8
|
|
|
9
|
+
# Install Imagemagick
|
|
10
|
+
RUN apt-get install -y libmagickwand-dev --no-install-recommends
|
|
11
|
+
|
|
12
|
+
# PHP Imagick ext
|
|
13
|
+
RUN pecl install imagick && docker-php-ext-enable imagick
|
|
14
|
+
|
|
15
|
+
# Install ghostscript
|
|
16
|
+
RUN apt-get install -y ghostscript
|
|
17
|
+
|
|
9
18
|
# Cleanup apt-get install folders
|
|
10
19
|
RUN apt-get clean && \
|
|
11
20
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE policymap [
|
|
3
|
+
<!ELEMENT policymap (policy)*>
|
|
4
|
+
<!ATTLIST policymap xmlns CDATA #FIXED ''>
|
|
5
|
+
<!ELEMENT policy EMPTY>
|
|
6
|
+
<!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
|
|
7
|
+
name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
|
|
8
|
+
stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
|
|
9
|
+
]>
|
|
10
|
+
<!--
|
|
11
|
+
Configure ImageMagick policies.
|
|
12
|
+
|
|
13
|
+
Domains include system, delegate, coder, filter, path, or resource.
|
|
14
|
+
|
|
15
|
+
Rights include none, read, write, execute and all. Use | to combine them,
|
|
16
|
+
for example: "read | write" to permit read from, or write to, a path.
|
|
17
|
+
|
|
18
|
+
Use a glob expression as a pattern.
|
|
19
|
+
|
|
20
|
+
Suppose we do not want users to process MPEG video images:
|
|
21
|
+
|
|
22
|
+
<policy domain="delegate" rights="none" pattern="mpeg:decode" />
|
|
23
|
+
|
|
24
|
+
Here we do not want users reading images from HTTP:
|
|
25
|
+
|
|
26
|
+
<policy domain="coder" rights="none" pattern="HTTP" />
|
|
27
|
+
|
|
28
|
+
The /repository file system is restricted to read only. We use a glob
|
|
29
|
+
expression to match all paths that start with /repository:
|
|
30
|
+
|
|
31
|
+
<policy domain="path" rights="read" pattern="/repository/*" />
|
|
32
|
+
|
|
33
|
+
Lets prevent users from executing any image filters:
|
|
34
|
+
|
|
35
|
+
<policy domain="filter" rights="none" pattern="*" />
|
|
36
|
+
|
|
37
|
+
Any large image is cached to disk rather than memory:
|
|
38
|
+
|
|
39
|
+
<policy domain="resource" name="area" value="1GP"/>
|
|
40
|
+
|
|
41
|
+
Use the default system font unless overwridden by the application:
|
|
42
|
+
|
|
43
|
+
<policy domain="system" name="font" value="/usr/share/fonts/favorite.ttf"/>
|
|
44
|
+
|
|
45
|
+
Define arguments for the memory, map, area, width, height and disk resources
|
|
46
|
+
with SI prefixes (.e.g 100MB). In addition, resource policies are maximums
|
|
47
|
+
for each instance of ImageMagick (e.g. policy memory limit 1GB, -limit 2GB
|
|
48
|
+
exceeds policy maximum so memory limit is 1GB).
|
|
49
|
+
|
|
50
|
+
Rules are processed in order. Here we want to restrict ImageMagick to only
|
|
51
|
+
read or write a small subset of proven web-safe image types:
|
|
52
|
+
|
|
53
|
+
<policy domain="delegate" rights="none" pattern="*" />
|
|
54
|
+
<policy domain="filter" rights="none" pattern="*" />
|
|
55
|
+
<policy domain="coder" rights="none" pattern="*" />
|
|
56
|
+
<policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />
|
|
57
|
+
-->
|
|
58
|
+
<policymap>
|
|
59
|
+
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
|
|
60
|
+
<policy domain="resource" name="memory" value="256MiB"/>
|
|
61
|
+
<policy domain="resource" name="map" value="512MiB"/>
|
|
62
|
+
<policy domain="resource" name="width" value="16KP"/>
|
|
63
|
+
<policy domain="resource" name="height" value="16KP"/>
|
|
64
|
+
<!-- <policy domain="resource" name="list-length" value="128"/> -->
|
|
65
|
+
<policy domain="resource" name="area" value="128MP"/>
|
|
66
|
+
<policy domain="resource" name="disk" value="1GiB"/>
|
|
67
|
+
<!-- <policy domain="resource" name="file" value="768"/> -->
|
|
68
|
+
<!-- <policy domain="resource" name="thread" value="4"/> -->
|
|
69
|
+
<!-- <policy domain="resource" name="throttle" value="0"/> -->
|
|
70
|
+
<!-- <policy domain="resource" name="time" value="3600"/> -->
|
|
71
|
+
<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
|
|
72
|
+
<!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
|
|
73
|
+
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
|
|
74
|
+
<!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
|
|
75
|
+
<!-- <policy domain="cache" name="synchronize" value="True"/> -->
|
|
76
|
+
<!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
|
|
77
|
+
<!-- <policy domain="system" name="max-memory-request" value="256MiB"/> -->
|
|
78
|
+
<!-- <policy domain="system" name="shred" value="2"/> -->
|
|
79
|
+
<!-- <policy domain="system" name="precision" value="6"/> -->
|
|
80
|
+
<!-- <policy domain="system" name="font" value="/path/to/font.ttf"/> -->
|
|
81
|
+
<!-- <policy domain="system" name="pixel-cache-memory" value="anonymous"/> -->
|
|
82
|
+
<!-- <policy domain="system" name="shred" value="2"/> -->
|
|
83
|
+
<!-- <policy domain="system" name="precision" value="6"/> -->
|
|
84
|
+
<!-- not needed due to the need to use explicitly by mvg: -->
|
|
85
|
+
<!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
|
|
86
|
+
<!-- use curl -->
|
|
87
|
+
<policy domain="delegate" rights="none" pattern="URL" />
|
|
88
|
+
<policy domain="delegate" rights="none" pattern="HTTPS" />
|
|
89
|
+
<policy domain="delegate" rights="none" pattern="HTTP" />
|
|
90
|
+
<!-- in order to avoid to get image with password text -->
|
|
91
|
+
<policy domain="path" rights="none" pattern="@*"/>
|
|
92
|
+
<!-- disable ghostscript format types -->
|
|
93
|
+
<!-- <policy domain="coder" rights="none" pattern="PS" />
|
|
94
|
+
<policy domain="coder" rights="none" pattern="PS2" />
|
|
95
|
+
<policy domain="coder" rights="none" pattern="PS3" />
|
|
96
|
+
<policy domain="coder" rights="none" pattern="EPS" />
|
|
97
|
+
<policy domain="coder" rights="none" pattern="PDF" />
|
|
98
|
+
<policy domain="coder" rights="none" pattern="XPS" /> -->
|
|
99
|
+
</policymap>
|
package/globals.js
CHANGED
|
@@ -37,6 +37,8 @@ if(composer && composer.require && composer.require['laravel/framework']){
|
|
|
37
37
|
platform = 'laravel';
|
|
38
38
|
} else if(composer && composer.require && composer.require['drupal/core-recommended']){
|
|
39
39
|
platform = 'drupal';
|
|
40
|
+
} else if(composer && composer.require && composer.require['craftcms/cms']){
|
|
41
|
+
platform = 'craftcms';
|
|
40
42
|
} else if(wordpress) {
|
|
41
43
|
platform = 'wordpress';
|
|
42
44
|
} else {
|
|
@@ -78,6 +80,12 @@ if(platform === 'laravel'){
|
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/drupal/9/docker-compose.yml ${core} -p ${repo}`;
|
|
83
|
+
} else if(platform === "craftcms"){
|
|
84
|
+
if(!existsSync(path.join(process.cwd(), '.env'))){
|
|
85
|
+
copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/craftcms/3/docker-compose.yml ${core} -p ${repo}`;
|
|
81
89
|
} else {
|
|
82
90
|
docker = `docker-compose ${core} -p ${repo}`;
|
|
83
91
|
}
|
|
@@ -110,7 +118,7 @@ module.exports = {
|
|
|
110
118
|
process.env.PORT = await getPort({port: getPort.makeRange(3000, 3100)});
|
|
111
119
|
process.env.PORT_OPT = +process.env.PORT + 1;
|
|
112
120
|
|
|
113
|
-
if(platform === "laravel" || platform === "wordpress" || platform === "drupal"){
|
|
121
|
+
if(platform === "laravel" || platform === "wordpress" || platform === "drupal" || platform === "craftcms"){
|
|
114
122
|
process.env.PORT_WEB = await getPort({port: getPort.makeRange(8000, 8100)});
|
|
115
123
|
process.env.PORT_DB = await getPort({port: getPort.makeRange(3306, 3406)});
|
|
116
124
|
}
|
|
@@ -122,7 +130,7 @@ module.exports = {
|
|
|
122
130
|
process.env.PORT = ports.PORT;
|
|
123
131
|
process.env.PORT_OPT = ports.PORT_OPT;
|
|
124
132
|
|
|
125
|
-
if(platform === "laravel" || platform === "wordpress" || platform === "drupal"){
|
|
133
|
+
if(platform === "laravel" || platform === "wordpress" || platform === "drupal" || platform === "craftcms"){
|
|
126
134
|
process.env.PORT_WEB = ports.PORT_WEB;
|
|
127
135
|
process.env.PORT_DB = ports.PORT_DB;
|
|
128
136
|
}
|
|
@@ -153,4 +161,4 @@ module.exports = {
|
|
|
153
161
|
if(!running) execSync(`lab-env down`, opts);
|
|
154
162
|
}
|
|
155
163
|
}
|
|
156
|
-
};
|
|
164
|
+
};
|
package/intercept.sh
CHANGED
|
@@ -16,6 +16,10 @@ artisan(){
|
|
|
16
16
|
command lab-env artisan "$@"
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
craft(){
|
|
20
|
+
command lab-env craft "$@"
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
php(){
|
|
20
24
|
command lab-env php "$@"
|
|
21
25
|
}
|
|
@@ -36,7 +40,8 @@ export -f npm;
|
|
|
36
40
|
export -f composer;
|
|
37
41
|
export -f drush;
|
|
38
42
|
export -f artisan;
|
|
43
|
+
export -f craft;
|
|
39
44
|
export -f php;
|
|
40
45
|
export -f chown;
|
|
41
46
|
export -f chmod;
|
|
42
|
-
export -f sed;
|
|
47
|
+
export -f sed;
|
|
@@ -22,7 +22,10 @@ services:
|
|
|
22
22
|
ports:
|
|
23
23
|
- "${PORT_WEB:-8000}:80"
|
|
24
24
|
php:
|
|
25
|
-
|
|
25
|
+
build:
|
|
26
|
+
context: ./php/
|
|
27
|
+
dockerfile: Dockerfile
|
|
28
|
+
image: lab-env/laravel/8/php:0.0.1
|
|
26
29
|
init: true
|
|
27
30
|
working_dir: /app
|
|
28
31
|
networks:
|
|
@@ -30,6 +33,7 @@ services:
|
|
|
30
33
|
volumes:
|
|
31
34
|
- $CWD/:/app
|
|
32
35
|
- ./php/custom.conf:/opt/bitnami/php/etc/custom.conf
|
|
36
|
+
- ./php/policy.xml:/etc/ImageMagick-6/policy.xml
|
|
33
37
|
- vendor:/app/vendor
|
|
34
38
|
redis:
|
|
35
39
|
image: redis:alpine
|
|
@@ -46,4 +50,4 @@ volumes:
|
|
|
46
50
|
mysql:
|
|
47
51
|
driver: "local"
|
|
48
52
|
redis:
|
|
49
|
-
driver: "local"
|
|
53
|
+
driver: "local"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
FROM chialab/php:7.4-fpm
|
|
2
|
+
|
|
3
|
+
MAINTAINER Mike Mellor
|
|
4
|
+
|
|
5
|
+
# Install Imagemagick
|
|
6
|
+
RUN apt-get update && \
|
|
7
|
+
apt-get install -y libmagickwand-dev --no-install-recommends
|
|
8
|
+
|
|
9
|
+
# PHP Imagick ext
|
|
10
|
+
RUN pecl install imagick && docker-php-ext-enable imagick
|
|
11
|
+
|
|
12
|
+
# Install ghostscript
|
|
13
|
+
RUN apt-get install -y ghostscript
|
|
14
|
+
|
|
15
|
+
# Cleanup apt-get install folders
|
|
16
|
+
RUN apt-get clean && \
|
|
17
|
+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE policymap [
|
|
3
|
+
<!ELEMENT policymap (policy)*>
|
|
4
|
+
<!ATTLIST policymap xmlns CDATA #FIXED ''>
|
|
5
|
+
<!ELEMENT policy EMPTY>
|
|
6
|
+
<!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
|
|
7
|
+
name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
|
|
8
|
+
stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
|
|
9
|
+
]>
|
|
10
|
+
<!--
|
|
11
|
+
Configure ImageMagick policies.
|
|
12
|
+
|
|
13
|
+
Domains include system, delegate, coder, filter, path, or resource.
|
|
14
|
+
|
|
15
|
+
Rights include none, read, write, execute and all. Use | to combine them,
|
|
16
|
+
for example: "read | write" to permit read from, or write to, a path.
|
|
17
|
+
|
|
18
|
+
Use a glob expression as a pattern.
|
|
19
|
+
|
|
20
|
+
Suppose we do not want users to process MPEG video images:
|
|
21
|
+
|
|
22
|
+
<policy domain="delegate" rights="none" pattern="mpeg:decode" />
|
|
23
|
+
|
|
24
|
+
Here we do not want users reading images from HTTP:
|
|
25
|
+
|
|
26
|
+
<policy domain="coder" rights="none" pattern="HTTP" />
|
|
27
|
+
|
|
28
|
+
The /repository file system is restricted to read only. We use a glob
|
|
29
|
+
expression to match all paths that start with /repository:
|
|
30
|
+
|
|
31
|
+
<policy domain="path" rights="read" pattern="/repository/*" />
|
|
32
|
+
|
|
33
|
+
Lets prevent users from executing any image filters:
|
|
34
|
+
|
|
35
|
+
<policy domain="filter" rights="none" pattern="*" />
|
|
36
|
+
|
|
37
|
+
Any large image is cached to disk rather than memory:
|
|
38
|
+
|
|
39
|
+
<policy domain="resource" name="area" value="1GP"/>
|
|
40
|
+
|
|
41
|
+
Use the default system font unless overwridden by the application:
|
|
42
|
+
|
|
43
|
+
<policy domain="system" name="font" value="/usr/share/fonts/favorite.ttf"/>
|
|
44
|
+
|
|
45
|
+
Define arguments for the memory, map, area, width, height and disk resources
|
|
46
|
+
with SI prefixes (.e.g 100MB). In addition, resource policies are maximums
|
|
47
|
+
for each instance of ImageMagick (e.g. policy memory limit 1GB, -limit 2GB
|
|
48
|
+
exceeds policy maximum so memory limit is 1GB).
|
|
49
|
+
|
|
50
|
+
Rules are processed in order. Here we want to restrict ImageMagick to only
|
|
51
|
+
read or write a small subset of proven web-safe image types:
|
|
52
|
+
|
|
53
|
+
<policy domain="delegate" rights="none" pattern="*" />
|
|
54
|
+
<policy domain="filter" rights="none" pattern="*" />
|
|
55
|
+
<policy domain="coder" rights="none" pattern="*" />
|
|
56
|
+
<policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />
|
|
57
|
+
-->
|
|
58
|
+
<policymap>
|
|
59
|
+
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
|
|
60
|
+
<policy domain="resource" name="memory" value="256MiB"/>
|
|
61
|
+
<policy domain="resource" name="map" value="512MiB"/>
|
|
62
|
+
<policy domain="resource" name="width" value="16KP"/>
|
|
63
|
+
<policy domain="resource" name="height" value="16KP"/>
|
|
64
|
+
<!-- <policy domain="resource" name="list-length" value="128"/> -->
|
|
65
|
+
<policy domain="resource" name="area" value="128MP"/>
|
|
66
|
+
<policy domain="resource" name="disk" value="1GiB"/>
|
|
67
|
+
<!-- <policy domain="resource" name="file" value="768"/> -->
|
|
68
|
+
<!-- <policy domain="resource" name="thread" value="4"/> -->
|
|
69
|
+
<!-- <policy domain="resource" name="throttle" value="0"/> -->
|
|
70
|
+
<!-- <policy domain="resource" name="time" value="3600"/> -->
|
|
71
|
+
<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
|
|
72
|
+
<!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
|
|
73
|
+
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
|
|
74
|
+
<!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
|
|
75
|
+
<!-- <policy domain="cache" name="synchronize" value="True"/> -->
|
|
76
|
+
<!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
|
|
77
|
+
<!-- <policy domain="system" name="max-memory-request" value="256MiB"/> -->
|
|
78
|
+
<!-- <policy domain="system" name="shred" value="2"/> -->
|
|
79
|
+
<!-- <policy domain="system" name="precision" value="6"/> -->
|
|
80
|
+
<!-- <policy domain="system" name="font" value="/path/to/font.ttf"/> -->
|
|
81
|
+
<!-- <policy domain="system" name="pixel-cache-memory" value="anonymous"/> -->
|
|
82
|
+
<!-- <policy domain="system" name="shred" value="2"/> -->
|
|
83
|
+
<!-- <policy domain="system" name="precision" value="6"/> -->
|
|
84
|
+
<!-- not needed due to the need to use explicitly by mvg: -->
|
|
85
|
+
<!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
|
|
86
|
+
<!-- use curl -->
|
|
87
|
+
<policy domain="delegate" rights="none" pattern="URL" />
|
|
88
|
+
<policy domain="delegate" rights="none" pattern="HTTPS" />
|
|
89
|
+
<policy domain="delegate" rights="none" pattern="HTTP" />
|
|
90
|
+
<!-- in order to avoid to get image with password text -->
|
|
91
|
+
<policy domain="path" rights="none" pattern="@*"/>
|
|
92
|
+
<!-- disable ghostscript format types -->
|
|
93
|
+
<!-- <policy domain="coder" rights="none" pattern="PS" />
|
|
94
|
+
<policy domain="coder" rights="none" pattern="PS2" />
|
|
95
|
+
<policy domain="coder" rights="none" pattern="PS3" />
|
|
96
|
+
<policy domain="coder" rights="none" pattern="EPS" />
|
|
97
|
+
<policy domain="coder" rights="none" pattern="PDF" />
|
|
98
|
+
<policy domain="coder" rights="none" pattern="XPS" /> -->
|
|
99
|
+
</policymap>
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishawack/lab-env",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"description": "Docker manager for FW",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "rm -rf _Test/_fixtures && mocha _Test/*.js --timeout 120s --bail",
|
|
7
|
+
"test": "rm -rf _Test/_fixtures && mkdir _Test/_fixtures && mocha _Test/*.js --timeout 120s --bail",
|
|
8
8
|
"preversion": "npm test",
|
|
9
9
|
"postversion": "git push && git push --tags && npm publish",
|
|
10
10
|
"postpublish": "git checkout development && git merge master && git push"
|