@fishawack/lab-env 4.15.1 → 4.16.0

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Changelog
2
2
 
3
+ ### 4.16.0 (2023-04-06)
4
+ * [Feature] added laravel@9 images to support laravel@9/10
5
+ * [Feature] added boilerplate-laravel-vue option to new commnad
6
+ * [Change] Bumped fishawack/lab-env-laravel-9-php to 1.0.0
7
+ * [Bug] docker ssh flag now moved to compose file
8
+
3
9
  ### 4.15.1 (2023-03-27)
4
10
  * [Bug] switch from docker-compose to docker compose
5
11
 
package/README.md CHANGED
@@ -103,12 +103,20 @@ Purge your NodeJs installation and install it via NVM [https://github.com/nvm-sh
103
103
 
104
104
  #### Problem
105
105
 
106
- Docker has 64gb of space by default. If you see the below message you need to have a sping clean and free up some space or give docker more memory.
106
+ Docker has 64gb of space by default. If you see the below messages you need to have a spring clean and free up some space or give docker more memory.
107
107
 
108
108
  ```bash
109
109
  npm WARN tar ENOSPC: no space left on device, write
110
110
  ```
111
111
 
112
+ When setting up a new project, one of the package may fail to pull from docker and shows an "invalid signature" or "is not signed" error:
113
+ ```bash
114
+ => ERROR [alpine 3/19] RUN apt-get update
115
+ Get:1 http://deb.debian.org/debian bullseye InRelease
116
+ W: GPG error: http://deb.debian.org/debian bullseye InRelease: At least one invalid signature was encountered.
117
+ E: The repository 'http://deb.debian.org/debian bullseye InRelease' is not signed.
118
+ ```
119
+
112
120
  #### Solution
113
121
 
114
122
  [Clean](#lab-env-troubleshooting-memory-limit) up your docker.
@@ -73,6 +73,10 @@ module.exports.templates = [
73
73
  "name": "boilerplate-laravel",
74
74
  "type": "boilerplate"
75
75
  },
76
+ {
77
+ "name": "boilerplate-laravel-vue",
78
+ "type": "boilerplate"
79
+ },
76
80
  {
77
81
  "name": "boilerplate-drupal",
78
82
  "type": "boilerplate"
@@ -11,5 +11,5 @@ module.exports = [
11
11
  default: ''
12
12
  });
13
13
  },
14
- argv => execSync(`${_.docker} build --ssh default ${argv.image}`, _.opts)
14
+ argv => execSync(`${_.docker} build ${argv.image}`, _.opts)
15
15
  ];
@@ -4,6 +4,8 @@ services:
4
4
  build:
5
5
  context: $DIRNAME/core/1/
6
6
  target: ${FW_CORE_1_TARGET:-alpine}
7
+ ssh:
8
+ - default
7
9
  image: ${FW_CORE_1_IMAGE:-fishawack/lab-env-core-1-alpine}:${FW_CORE_1_VERSION:-latest}
8
10
  init: true
9
11
  tty: true
package/globals.js CHANGED
@@ -60,6 +60,26 @@ try{ wordpress = existsSync(path.join(process.cwd(), 'wp-content/')); } catch(e)
60
60
 
61
61
  if(composer && composer.require && composer.require['laravel/framework']){
62
62
  platform = 'laravel';
63
+ const versions = getDirectories(path.resolve(__dirname, './laravel')).map(d => path.basename(d)).sort((a, b) => +a - +b);
64
+ const version = semver.coerce(composer.require['laravel/framework'])?.version;
65
+
66
+ if(process.env.FW_NEXT){
67
+ process.env.VERSION_LARAVEL = versions[versions.length - 1];
68
+ } else if(semver.satisfies(version, '<=8')){
69
+ process.env.VERSION_LARAVEL = '8';
70
+ } else if(semver.satisfies(version, '<=10')) {
71
+ process.env.VERSION_LARAVEL = '9';
72
+ } else {
73
+ if(args[0] !== 'diag' && args[0] !== 'diagnose' && args[0] !== 'origin' && args[0] !== '--version' && args[0] !== '--help' && args[0] !== 'new' && args[0] !== 'key' && args[0] !== 'dekey'){
74
+ if(!args.find(d => d === '--force')){
75
+ console.log(`${utilities.colorize(`laravel`, 'title')} and ${utilities.colorize(`@fishawack/lab-env`, 'title')} have mismatching versions.\n\nRun ${utilities.colorize(`npm i -g @fishawack/lab-env@latest`, 'success')} or pass ${utilities.colorize(`--force`, 'warning')} to continue.`);
76
+ process.exit(1);
77
+ }
78
+ }
79
+
80
+ // Default to latest image when outside of known core versions
81
+ process.env.VERSION_LARAVEL = versions[versions.length - 1];
82
+ }
63
83
  } else if(composer && composer.require && composer.require['drupal/core-recommended']){
64
84
  platform = 'drupal';
65
85
  } else if(composer && composer.require && composer.require['craftcms/cms']){
@@ -110,6 +130,7 @@ var core = `-f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml`;
110
130
  // Map versions of images
111
131
  process.env.FW_CORE_0_VERSION = process.env.FW_CORE_0_VERSION || require('./core/0/package.json').version;
112
132
  process.env.FW_CORE_1_VERSION = process.env.FW_CORE_1_VERSION || require('./core/1/package.json').version;
133
+ process.env.FW_LARAVEL_9_PHP_VERSION = process.env.FW_LARAVEL_9_PHP_VERSION || require('./laravel/9/php/package.json').version;
113
134
  process.env.FW_LARAVEL_8_PHP_VERSION = process.env.FW_LARAVEL_8_PHP_VERSION || require('./laravel/8/php/package.json').version;
114
135
  process.env.FW_LARAVEL_8_NGINX_VERSION = process.env.FW_LARAVEL_8_NGINX_VERSION || require('./laravel/8/nginx/package.json').version;
115
136
  process.env.FW_DRUPAL_9_PHP_VERSION = process.env.FW_DRUPAL_9_PHP_VERSION || require('./drupal/9/php/package.json').version;
@@ -123,7 +144,7 @@ if(existsSync(path.join(process.cwd(), '.env.example')) && !existsSync(path.join
123
144
  }
124
145
 
125
146
  if(platform === 'laravel'){
126
- let container = `-f ${__dirname}/laravel/8/docker-compose.yml`;
147
+ let container = `-f ${__dirname}/laravel/${process.env.VERSION_LARAVEL}/docker-compose.yml`;
127
148
 
128
149
  docker = `docker compose --env-file ${path.join(process.cwd(), '.env')} ${container} ${core} -p ${repo_safe}`;
129
150
  } else if(platform === 'wordpress'){
@@ -0,0 +1,57 @@
1
+ services:
2
+ mysql:
3
+ image: mysql:8.0.32
4
+ networks:
5
+ - default
6
+ environment:
7
+ - MYSQL_ROOT_PASSWORD=password
8
+ - MYSQL_DATABASE=${DB_DATABASE}
9
+ - MYSQL_USER=${DB_USERNAME}
10
+ - MYSQL_PASSWORD=${DB_PASSWORD}
11
+ ports:
12
+ - "${PORT_DB:-3306}:3306"
13
+ volumes:
14
+ - mysql:/var/lib/mysql
15
+ nginx:
16
+ build:
17
+ context: $DIRNAME/laravel/8/nginx/
18
+ target: development
19
+ image: fishawack/lab-env-laravel-8-nginx:${FW_LARAVEL_8_NGINX_VERSION:-latest}
20
+ networks:
21
+ - default
22
+ volumes:
23
+ - $CWD/:/app
24
+ ports:
25
+ - "${PORT_WEB:-8000}:80"
26
+ php:
27
+ build:
28
+ context: $DIRNAME/laravel/9/php/
29
+ target: development
30
+ image: fishawack/lab-env-laravel-9-php:${FW_LARAVEL_9_PHP_VERSION:-latest}
31
+ init: true
32
+ working_dir: /app
33
+ networks:
34
+ - default
35
+ volumes:
36
+ - $CWD/:/app
37
+ - vendor:/app/vendor
38
+ environment:
39
+ - FW_ROOT=${FW_ROOT:-}
40
+ - USER_UID=${USER_UID:-0}
41
+ - USER_GID=${USER_GID:-0}
42
+ redis:
43
+ image: redis:alpine
44
+ networks:
45
+ - default
46
+ volumes:
47
+ - redis:/data
48
+ networks:
49
+ default:
50
+ driver: "bridge"
51
+ volumes:
52
+ vendor:
53
+ driver: "local"
54
+ mysql:
55
+ driver: "local"
56
+ redis:
57
+ driver: "local"
@@ -0,0 +1,4 @@
1
+ ## Changelog
2
+
3
+ ### 1.0.0 (2023-04-06)
4
+ * [Misc] initial commit
@@ -0,0 +1,37 @@
1
+ FROM chialab/php:8.2-fpm AS development
2
+
3
+ MAINTAINER Mike Mellor
4
+
5
+ # Install ghostscript
6
+ RUN apt-get update && \
7
+ apt-get install -y ghostscript
8
+
9
+ # Copy custom.ini
10
+ COPY ./custom.ini /usr/local/etc/php/conf.d/custom.ini
11
+
12
+ # Copy ImageMagick policy
13
+ COPY ./policy.xml /etc/ImageMagick-6/policy.xml
14
+
15
+ # Add php user
16
+ RUN useradd -m -G www-data -s /bin/bash php
17
+
18
+ # Cleanup apt-get install folders
19
+ RUN apt-get clean && \
20
+ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
21
+
22
+ COPY entrypoint.sh /bin/entrypoint.sh
23
+ RUN chmod +x /bin/entrypoint.sh
24
+ ENTRYPOINT ["/bin/entrypoint.sh"]
25
+
26
+ CMD ["php-fpm"]
27
+
28
+ FROM fishawack/lab-env-laravel-9-php:latest AS production
29
+
30
+ # Copy source code into container
31
+ COPY . /app
32
+
33
+ # Install composer dependencies
34
+ RUN TEMPFILE=$(mktemp) && \
35
+ curl -o "$TEMPFILE" "https://getcomposer.org/installer" && \
36
+ php <"$TEMPFILE" && \
37
+ ./composer.phar install -d /app --no-dev --no-interaction --no-ansi --optimize-autoloader
@@ -0,0 +1,5 @@
1
+ file_uploads = On
2
+ memory_limit = 500M
3
+ upload_max_filesize = 500M
4
+ post_max_size = 500M
5
+ max_execution_time = 600
@@ -0,0 +1,24 @@
1
+ #!/bin/bash
2
+
3
+ # Setting $FW_ROOT will bypass the user switch to php
4
+ if [ -z "$FW_ROOT" ]; then
5
+ # Set php user id to match host users id so no permission issues outside of docker
6
+ usermod -u $USER_UID php &>/dev/null
7
+
8
+ # Fix access rights to stdout and stderr
9
+ chown php /proc/self/fd/{1,2}
10
+
11
+ # Own the vendor folder otherwise it'll be owned by root/previous php id which will prevent writing
12
+ chown php /app/vendor
13
+
14
+ # If bash command then start an non login interactive shell
15
+ if [[ "$@" == "bash" ]]; then
16
+ exec su php
17
+ # Otherwise pipe the command into the non login non interactive shell as a command to exec
18
+ else
19
+ exec su php -c "$@"
20
+ fi
21
+ else
22
+ echo "Accessing as root"
23
+ exec "$@"
24
+ fi
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "php",
3
+ "version": "1.0.0",
4
+ "description": "lab-env docker config for the php module",
5
+ "scripts": {
6
+ "preversion": "docker login",
7
+ "postversion": "docker buildx build --target development --platform linux/amd64,linux/arm64 -t fishawack/lab-env-laravel-9-php:$npm_package_version -t fishawack/lab-env-laravel-9-php:latest --push . && git add . && git commit -m \"build: Bumped fishawack/lab-env-laravel-9-php to $npm_package_version\""
8
+ },
9
+ "author": "Mike Mellor",
10
+ "license": "ISC"
11
+ }
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-env",
3
- "version": "4.15.1",
3
+ "version": "4.16.0",
4
4
  "description": "Docker manager for FW",
5
5
  "main": "cli.js",
6
6
  "scripts": {