@fishawack/lab-env 4.14.0 → 4.15.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/.gitlab-ci.yml +2 -3
- package/CHANGELOG.md +66 -0
- package/commands/artisan.js +1 -3
- package/commands/check.js +2 -4
- package/commands/clean.js +2 -4
- package/commands/composer.js +1 -3
- package/commands/connect.js +1 -16
- package/commands/content.js +1 -3
- package/commands/craft.js +1 -3
- package/commands/deploy.js +1 -1
- package/commands/docker/mocha.js +1 -1
- package/commands/drush.js +1 -3
- package/commands/execute.js +8 -3
- package/commands/install.js +1 -3
- package/commands/npm.js +1 -3
- package/commands/php.js +1 -3
- package/commands/production.js +1 -3
- package/commands/regenerate.js +2 -4
- package/commands/reinstall.js +2 -4
- package/commands/run.js +1 -3
- package/commands/setup.js +1 -1
- package/commands/start.js +4 -14
- package/commands/test.js +2 -12
- package/commands/uninstall.js +1 -3
- package/commands/watch.js +9 -3
- package/commands/wp.js +1 -1
- package/core/0/docker-compose.yml +2 -0
- package/core/1/CHANGELOG.md +4 -0
- package/core/1/Dockerfile +6 -0
- package/core/1/docker-compose.yml +3 -0
- package/core/1/package.json +1 -1
- package/craftcms/3/apache/CHANGELOG.md +4 -0
- package/craftcms/3/apache/Dockerfile +11 -0
- package/craftcms/3/apache/httpd.conf +554 -0
- package/craftcms/3/apache/package.json +11 -0
- package/craftcms/3/docker-compose.yml +16 -12
- package/craftcms/3/php/CHANGELOG.md +4 -0
- package/craftcms/3/php/Dockerfile +32 -6
- package/craftcms/3/php/custom.ini +5 -0
- package/craftcms/3/php/entrypoint.sh +24 -0
- package/craftcms/3/php/package.json +11 -0
- package/drupal/9/apache/CHANGELOG.md +4 -0
- package/drupal/9/apache/package.json +1 -1
- package/drupal/9/docker-compose.yml +13 -7
- package/drupal/9/php/CHANGELOG.md +5 -0
- package/drupal/9/php/Dockerfile +9 -0
- package/drupal/9/php/entrypoint.sh +27 -0
- package/drupal/9/php/package.json +2 -2
- package/globals.js +56 -68
- package/intercept.sh +5 -0
- package/laravel/8/docker-compose.yml +10 -3
- package/laravel/8/nginx/package.json +1 -1
- package/laravel/8/php/CHANGELOG.md +6 -0
- package/laravel/8/php/Dockerfile +9 -3
- package/laravel/8/php/entrypoint.sh +24 -0
- package/laravel/8/php/package.json +2 -2
- package/package.json +2 -2
- package/wordpress/0/CHANGELOG.md +4 -0
- package/wordpress/{5.7.2/wordpress → 0}/Dockerfile +4 -1
- package/wordpress/{5.7.2 → 0}/docker-compose.yml +4 -8
- package/wordpress/0/package.json +11 -0
- package/core/0/docker-compose-dev.yml +0 -5
- package/core/1/docker-compose-dev.yml +0 -6
- package/craftcms/3/nginx/nginx.conf +0 -37
- package/craftcms/3/php/custom.conf +0 -9
- package/drupal/9/docker-compose-dev.yml +0 -11
- package/laravel/8/docker-compose-dev.yml +0 -11
- package/laravel/8/php/custom.conf +0 -9
- package/wordpress/5.7.2/apache/.htaccess +0 -25
- /package/wordpress/{5.7.2/apache/uploads.ini → 0/custom.ini} +0 -0
|
@@ -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-craftcms-3-php:$npm_package_version -t fishawack/lab-env-craftcms-3-php:latest --push . && git add . && git commit -m \"build: Bumped fishawack/lab-env-craftcms-3-php to $npm_package_version\""
|
|
8
|
+
},
|
|
9
|
+
"author": "Mike Mellor",
|
|
10
|
+
"license": "ISC"
|
|
11
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "lab-env docker config for the apache module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"preversion": "docker login",
|
|
7
|
-
"postversion": "docker build
|
|
7
|
+
"postversion": "docker buildx build --target development --platform linux/amd64,linux/arm64 -t fishawack/lab-env-drupal-9-apache:$npm_package_version -t fishawack/lab-env-drupal-9-apache:latest --push . && git add . && git commit -m \"build: Bumped fishawack/lab-env-drupal-9-apache to $npm_package_version\""
|
|
8
8
|
},
|
|
9
9
|
"author": "Mike Mellor",
|
|
10
10
|
"license": "ISC"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
services:
|
|
2
2
|
mysql:
|
|
3
|
-
|
|
4
|
-
image: mysql:8.0.23
|
|
3
|
+
image: mysql:8.0.32
|
|
5
4
|
networks:
|
|
6
5
|
- default
|
|
7
6
|
environment:
|
|
@@ -17,8 +16,10 @@ services:
|
|
|
17
16
|
- seccomp:unconfined
|
|
18
17
|
command: --default-authentication-plugin=mysql_native_password
|
|
19
18
|
apache:
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
build:
|
|
20
|
+
context: $DIRNAME/drupal/9/apache/
|
|
21
|
+
target: development
|
|
22
|
+
image: fishawack/lab-env-drupal-9-apache:${FW_DRUPAL_9_APACHE_VERSION:-latest}
|
|
22
23
|
working_dir: /app
|
|
23
24
|
networks:
|
|
24
25
|
- default
|
|
@@ -32,8 +33,10 @@ services:
|
|
|
32
33
|
ports:
|
|
33
34
|
- "${PORT_WEB:-8000}:8080"
|
|
34
35
|
php:
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
build:
|
|
37
|
+
context: $DIRNAME/drupal/9/php/
|
|
38
|
+
target: development
|
|
39
|
+
image: fishawack/lab-env-drupal-9-php:${FW_DRUPAL_9_PHP_VERSION:-latest}
|
|
37
40
|
init: true
|
|
38
41
|
working_dir: /app
|
|
39
42
|
networks:
|
|
@@ -46,8 +49,11 @@ services:
|
|
|
46
49
|
- $CWD/profiles:/app/web/profiles
|
|
47
50
|
- vendor:/app/vendor
|
|
48
51
|
- drupal:/app/web
|
|
52
|
+
environment:
|
|
53
|
+
- FW_ROOT=${FW_ROOT:-}
|
|
54
|
+
- USER_UID=${USER_UID:-0}
|
|
55
|
+
- USER_GID=${USER_GID:-0}
|
|
49
56
|
core:
|
|
50
|
-
platform: linux/amd64
|
|
51
57
|
volumes:
|
|
52
58
|
- drupal:/app/web
|
|
53
59
|
|
package/drupal/9/php/Dockerfile
CHANGED
|
@@ -15,10 +15,19 @@ COPY ./custom.ini /usr/local/etc/php/conf.d/custom.ini
|
|
|
15
15
|
# Copy ImageMagick policy
|
|
16
16
|
COPY ./policy.xml /etc/ImageMagick-6/policy.xml
|
|
17
17
|
|
|
18
|
+
# Add php user
|
|
19
|
+
RUN useradd -m -G www-data -s /bin/bash php
|
|
20
|
+
|
|
18
21
|
# Cleanup apt-get install folders
|
|
19
22
|
RUN apt-get clean && \
|
|
20
23
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
21
24
|
|
|
25
|
+
COPY entrypoint.sh /bin/entrypoint.sh
|
|
26
|
+
RUN chmod +x /bin/entrypoint.sh
|
|
27
|
+
ENTRYPOINT ["/bin/entrypoint.sh"]
|
|
28
|
+
|
|
29
|
+
CMD ["php-fpm"]
|
|
30
|
+
|
|
22
31
|
FROM fishawack/lab-env-drupal-9-php:latest AS production
|
|
23
32
|
|
|
24
33
|
# Copy source code into container
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
# Own the web folder otherwise it'll be owned by root/previous php id which will prevent writing
|
|
15
|
+
chown php /app/web
|
|
16
|
+
|
|
17
|
+
# If bash command then start an non login interactive shell
|
|
18
|
+
if [[ "$@" == "bash" ]]; then
|
|
19
|
+
exec su php
|
|
20
|
+
# Otherwise pipe the command into the non login non interactive shell as a command to exec
|
|
21
|
+
else
|
|
22
|
+
exec su php -c "$@"
|
|
23
|
+
fi
|
|
24
|
+
else
|
|
25
|
+
echo "Accessing as root"
|
|
26
|
+
exec "$@"
|
|
27
|
+
fi
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "php",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "lab-env docker config for the php module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"preversion": "docker login",
|
|
7
|
-
"postversion": "docker build
|
|
7
|
+
"postversion": "docker buildx build --target development --platform linux/amd64,linux/arm64 -t fishawack/lab-env-drupal-9-php:$npm_package_version -t fishawack/lab-env-drupal-9-php:latest --push . && git add . && git commit -m \"build: Bumped fishawack/lab-env-drupal-9-php to $npm_package_version\""
|
|
8
8
|
},
|
|
9
9
|
"author": "Mike Mellor",
|
|
10
10
|
"license": "ISC"
|
package/globals.js
CHANGED
|
@@ -21,14 +21,16 @@ var platform;
|
|
|
21
21
|
var pkg;
|
|
22
22
|
var composer;
|
|
23
23
|
var docker;
|
|
24
|
-
var method;
|
|
25
|
-
var run;
|
|
26
24
|
var exec;
|
|
27
25
|
var running;
|
|
28
26
|
var services;
|
|
29
27
|
var branch;
|
|
30
28
|
var diagnosis = '3.0.0';
|
|
31
29
|
var opts = {encoding: 'utf8', stdio: 'inherit', shell: '/bin/bash'};
|
|
30
|
+
const users = {
|
|
31
|
+
core: "node",
|
|
32
|
+
php: "php"
|
|
33
|
+
};
|
|
32
34
|
|
|
33
35
|
try{
|
|
34
36
|
config = JSON.parse(readFileSync(`${os.homedir()}/.lab-env`, {encoding: 'utf8'}));
|
|
@@ -105,64 +107,41 @@ if(process.env.FW_FULL){
|
|
|
105
107
|
|
|
106
108
|
var core = `-f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml`;
|
|
107
109
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
// Map versions of images
|
|
111
|
+
process.env.FW_CORE_0_VERSION = process.env.FW_CORE_0_VERSION || require('./core/0/package.json').version;
|
|
112
|
+
process.env.FW_CORE_1_VERSION = process.env.FW_CORE_1_VERSION || require('./core/1/package.json').version;
|
|
113
|
+
process.env.FW_LARAVEL_8_PHP_VERSION = process.env.FW_LARAVEL_8_PHP_VERSION || require('./laravel/8/php/package.json').version;
|
|
114
|
+
process.env.FW_LARAVEL_8_NGINX_VERSION = process.env.FW_LARAVEL_8_NGINX_VERSION || require('./laravel/8/nginx/package.json').version;
|
|
115
|
+
process.env.FW_DRUPAL_9_PHP_VERSION = process.env.FW_DRUPAL_9_PHP_VERSION || require('./drupal/9/php/package.json').version;
|
|
116
|
+
process.env.FW_DRUPAL_9_APACHE_VERSION = process.env.FW_DRUPAL_9_APACHE_VERSION || require('./drupal/9/apache/package.json').version;
|
|
117
|
+
process.env.FW_CRAFTCMS_3_PHP_VERSION = process.env.FW_CRAFTCMS_3_PHP_VERSION || require('./craftcms/3/php/package.json').version;
|
|
118
|
+
process.env.FW_CRAFTCMS_3_APACHE_VERSION = process.env.FW_CRAFTCMS_3_APACHE_VERSION || require('./craftcms/3/apache/package.json').version;
|
|
119
|
+
process.env.FW_WORDPRESS_0_VERSION = process.env.FW_WORDPRESS_0_VERSION || require('./wordpress/0/package.json').version;
|
|
120
|
+
|
|
121
|
+
if(existsSync(path.join(process.cwd(), '.env.example')) && !existsSync(path.join(process.cwd(), '.env'))){
|
|
122
|
+
copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
if(platform === 'laravel'){
|
|
119
|
-
if(!existsSync(path.join(process.cwd(), '.env'))){
|
|
120
|
-
copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
126
|
let container = `-f ${__dirname}/laravel/8/docker-compose.yml`;
|
|
124
127
|
|
|
125
|
-
|
|
126
|
-
container = `-f ${__dirname}/laravel/8/docker-compose-dev.yml ${container}`;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} ${container} ${core} -p ${repo_safe}`;
|
|
128
|
+
docker = `docker compose --env-file ${path.join(process.cwd(), '.env')} ${container} ${core} -p ${repo_safe}`;
|
|
130
129
|
} else if(platform === 'wordpress'){
|
|
131
|
-
|
|
132
|
-
copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/wordpress/5.7.2/docker-compose.yml ${core} -p ${repo_safe}`;
|
|
130
|
+
docker = `docker compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/wordpress/0/docker-compose.yml ${core} -p ${repo_safe}`;
|
|
136
131
|
} else if(platform === "drupal"){
|
|
137
|
-
if(!existsSync(path.join(process.cwd(), '.env'))){
|
|
138
|
-
copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
132
|
let container = `-f ${__dirname}/drupal/9/docker-compose.yml`;
|
|
142
|
-
|
|
143
|
-
if(process.env.FW_DEV){
|
|
144
|
-
container = `-f ${__dirname}/drupal/9/docker-compose-dev.yml ${container}`;
|
|
145
|
-
}
|
|
146
133
|
|
|
147
|
-
docker = `docker
|
|
134
|
+
docker = `docker compose --env-file ${path.join(process.cwd(), '.env')} ${container} ${core} -p ${repo_safe}`;
|
|
148
135
|
} else if(platform === "craftcms"){
|
|
149
|
-
|
|
150
|
-
copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/craftcms/3/docker-compose.yml ${core} -p ${repo_safe}`;
|
|
136
|
+
docker = `docker compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/craftcms/3/docker-compose.yml ${core} -p ${repo_safe}`;
|
|
154
137
|
} else {
|
|
155
|
-
docker = `docker
|
|
138
|
+
docker = `docker compose ${core} -p ${repo_safe}`;
|
|
156
139
|
}
|
|
157
140
|
|
|
158
141
|
try{
|
|
159
142
|
services = execSync(`${docker} ps --services --filter "status=running"`, {encoding: 'utf8', stdio: 'pipe'});
|
|
160
143
|
running = services.trim().length;
|
|
161
144
|
exec = `exec ${process.env.CI_BUILD_ID ? '-T' : ''}`;
|
|
162
|
-
method = running ? exec : 'run --rm --service-ports';
|
|
163
|
-
// Set user on exec command using core@1
|
|
164
|
-
// Login on core@0 so .bash_profile is loaded
|
|
165
|
-
run = `${method} ${(running && process.env.VERSION === "1") ? '-u node ' : ''}core bash${(process.env.VERSION === "0") ? ' -l' : ''}`;
|
|
166
145
|
} catch(e){
|
|
167
146
|
if(args.find(d => d === '--debug')){
|
|
168
147
|
console.log(utilities.colorize(e.stderr, 'error'));
|
|
@@ -224,11 +203,10 @@ module.exports = {
|
|
|
224
203
|
repo_safe,
|
|
225
204
|
pkg,
|
|
226
205
|
docker,
|
|
227
|
-
method,
|
|
228
|
-
run,
|
|
229
206
|
exec,
|
|
230
207
|
running,
|
|
231
208
|
opts,
|
|
209
|
+
users,
|
|
232
210
|
ports: {
|
|
233
211
|
async set(){
|
|
234
212
|
if(!running){
|
|
@@ -239,43 +217,53 @@ module.exports = {
|
|
|
239
217
|
process.env.PORT_WEB = await getPort({port: getPort.makeRange(8000, 8100)});
|
|
240
218
|
process.env.PORT_DB = await getPort({port: getPort.makeRange(3306, 3406)});
|
|
241
219
|
}
|
|
242
|
-
} else {
|
|
243
|
-
try{
|
|
244
|
-
let env = execSync(`${docker} exec -T core env`, {encoding: 'utf8'});
|
|
245
|
-
let ports = env.split('\n').reduce((obj, d) => { obj[d.split('=')[0]] = d.split('=')[1]; return obj; }, {});
|
|
246
|
-
|
|
247
|
-
process.env.PORT = ports.PORT;
|
|
248
|
-
process.env.PORT_OPT = ports.PORT_OPT;
|
|
249
|
-
|
|
250
|
-
if(platform === "laravel" || platform === "wordpress" || platform === "drupal" || platform === "craftcms"){
|
|
251
|
-
process.env.PORT_WEB = ports.PORT_WEB;
|
|
252
|
-
process.env.PORT_DB = ports.PORT_DB;
|
|
253
|
-
}
|
|
254
|
-
} catch(e){
|
|
255
|
-
console.log(e.message);
|
|
256
|
-
|
|
257
|
-
process.exit(1);
|
|
258
|
-
}
|
|
259
220
|
}
|
|
260
221
|
},
|
|
261
222
|
get(){
|
|
262
|
-
|
|
223
|
+
if(!running){
|
|
224
|
+
let ports = { core: {port: +process.env.PORT} };
|
|
263
225
|
|
|
264
|
-
|
|
265
|
-
|
|
226
|
+
if(+process.env.PORT_WEB) ports.web = {port: +process.env.PORT_WEB};
|
|
227
|
+
if(+process.env.PORT_DB) ports.db = {port: +process.env.PORT_DB};
|
|
266
228
|
|
|
267
|
-
|
|
229
|
+
console.table(ports);
|
|
230
|
+
}
|
|
268
231
|
}
|
|
269
232
|
},
|
|
270
233
|
up(cb, err){
|
|
271
|
-
|
|
234
|
+
let alreadyRunning = running;
|
|
235
|
+
|
|
236
|
+
if(!running){
|
|
237
|
+
execSync(`lab-env up -d`, opts);
|
|
238
|
+
running = true;
|
|
239
|
+
}
|
|
272
240
|
|
|
273
241
|
try{
|
|
274
242
|
cb();
|
|
275
243
|
} catch(e){
|
|
276
244
|
throw(e);
|
|
277
245
|
} finally{
|
|
278
|
-
if(!
|
|
246
|
+
if(!alreadyRunning){
|
|
247
|
+
execSync(`lab-env down`, opts);
|
|
248
|
+
running = false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
command(container, command, ignoreErrors){
|
|
253
|
+
const method = running ? exec : 'run --rm --service-ports';
|
|
254
|
+
let run = ` ${command ? '-c' : ''}`;
|
|
255
|
+
let user = '';
|
|
256
|
+
|
|
257
|
+
// Don't login on core@1 so /etc/profile isn't loaded and $PATH reset (likely don't need to login on anything other than core@0 but need test suite to check)
|
|
258
|
+
if(process.env.VERSION === "0"){
|
|
259
|
+
run += ' -l';
|
|
279
260
|
}
|
|
261
|
+
if(process.env.VERSION === "1"){
|
|
262
|
+
if(running){
|
|
263
|
+
user = users[container] && ` -u ${users[container]}` || '';
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
execSync(`${docker} ${method}${user} ${container} bash${run}${command ? ` "${command}"` : ''}${ignoreErrors ? ' 2>/dev/null' : ''}`, opts);
|
|
280
268
|
}
|
|
281
269
|
};
|
package/intercept.sh
CHANGED
|
@@ -36,6 +36,10 @@ chown(){
|
|
|
36
36
|
command lab-env exec "chown $@"
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
chgrp(){
|
|
40
|
+
command lab-env exec "chgrp $@"
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
sed(){
|
|
40
44
|
command lab-env exec "sed $@"
|
|
41
45
|
}
|
|
@@ -57,6 +61,7 @@ export -f wp;
|
|
|
57
61
|
export -f php;
|
|
58
62
|
export -f chown;
|
|
59
63
|
export -f chmod;
|
|
64
|
+
export -f chgrp;
|
|
60
65
|
export -f sed;
|
|
61
66
|
export -f unzip;
|
|
62
67
|
export -f zip;
|
|
@@ -14,7 +14,9 @@ services:
|
|
|
14
14
|
volumes:
|
|
15
15
|
- mysql:/var/lib/mysql
|
|
16
16
|
nginx:
|
|
17
|
-
|
|
17
|
+
build:
|
|
18
|
+
context: $DIRNAME/laravel/8/nginx/
|
|
19
|
+
target: development
|
|
18
20
|
image: fishawack/lab-env-laravel-8-nginx:${FW_LARAVEL_8_NGINX_VERSION:-latest}
|
|
19
21
|
networks:
|
|
20
22
|
- default
|
|
@@ -23,7 +25,9 @@ services:
|
|
|
23
25
|
ports:
|
|
24
26
|
- "${PORT_WEB:-8000}:80"
|
|
25
27
|
php:
|
|
26
|
-
|
|
28
|
+
build:
|
|
29
|
+
context: $DIRNAME/laravel/8/php/
|
|
30
|
+
target: development
|
|
27
31
|
image: fishawack/lab-env-laravel-8-php:${FW_LARAVEL_8_PHP_VERSION:-latest}
|
|
28
32
|
init: true
|
|
29
33
|
working_dir: /app
|
|
@@ -32,8 +36,11 @@ services:
|
|
|
32
36
|
volumes:
|
|
33
37
|
- $CWD/:/app
|
|
34
38
|
- vendor:/app/vendor
|
|
39
|
+
environment:
|
|
40
|
+
- FW_ROOT=${FW_ROOT:-}
|
|
41
|
+
- USER_UID=${USER_UID:-0}
|
|
42
|
+
- USER_GID=${USER_GID:-0}
|
|
35
43
|
redis:
|
|
36
|
-
platform: linux/amd64
|
|
37
44
|
image: redis:alpine
|
|
38
45
|
networks:
|
|
39
46
|
- default
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "lab-env docker config for the nginx module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"preversion": "docker login",
|
|
7
|
-
"postversion": "docker build
|
|
7
|
+
"postversion": "docker buildx build --target development --platform linux/amd64,linux/arm64 -t fishawack/lab-env-laravel-8-nginx:$npm_package_version -t fishawack/lab-env-laravel-8-nginx:latest --push . && git add . && git commit -m \"build: Bumped fishawack/lab-env-laravel-8-nginx to $npm_package_version\""
|
|
8
8
|
},
|
|
9
9
|
"author": "Mike Mellor",
|
|
10
10
|
"license": "ISC"
|
package/laravel/8/php/Dockerfile
CHANGED
|
@@ -6,19 +6,25 @@ MAINTAINER Mike Mellor
|
|
|
6
6
|
RUN apt-get update && \
|
|
7
7
|
apt-get install -y ghostscript
|
|
8
8
|
|
|
9
|
-
# Copy php conf
|
|
10
|
-
COPY ./custom.conf /opt/bitnami/php/etc/custom.conf
|
|
11
|
-
|
|
12
9
|
# Copy custom.ini
|
|
13
10
|
COPY ./custom.ini /usr/local/etc/php/conf.d/custom.ini
|
|
14
11
|
|
|
15
12
|
# Copy ImageMagick policy
|
|
16
13
|
COPY ./policy.xml /etc/ImageMagick-6/policy.xml
|
|
17
14
|
|
|
15
|
+
# Add php user
|
|
16
|
+
RUN useradd -m -G www-data -s /bin/bash php
|
|
17
|
+
|
|
18
18
|
# Cleanup apt-get install folders
|
|
19
19
|
RUN apt-get clean && \
|
|
20
20
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
21
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
|
+
|
|
22
28
|
FROM fishawack/lab-env-laravel-8-php:latest AS production
|
|
23
29
|
|
|
24
30
|
# Copy source code into container
|
|
@@ -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
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "php",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "lab-env docker config for the php module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"preversion": "docker login",
|
|
7
|
-
"postversion": "docker build
|
|
7
|
+
"postversion": "docker buildx build --target development --platform linux/amd64,linux/arm64 -t fishawack/lab-env-laravel-8-php:$npm_package_version -t fishawack/lab-env-laravel-8-php:latest --push . && git add . && git commit -m \"build: Bumped fishawack/lab-env-laravel-8-php to $npm_package_version\""
|
|
8
8
|
},
|
|
9
9
|
"author": "Mike Mellor",
|
|
10
10
|
"license": "ISC"
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishawack/lab-env",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.15.1",
|
|
4
4
|
"description": "Docker manager for FW",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "rm -rf _Test/_fixtures/boilerplate*; CI_BUILD_ID=true mocha _Test/*.js --timeout
|
|
7
|
+
"test": "rm -rf _Test/_fixtures/boilerplate*; CI_BUILD_ID=true mocha _Test/*.js --timeout 12000s --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"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
FROM wordpress:5.7.2
|
|
1
|
+
FROM wordpress:5.7.2 AS development
|
|
2
2
|
|
|
3
3
|
MAINTAINER Mike Mellor
|
|
4
4
|
|
|
@@ -11,6 +11,9 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli
|
|
|
11
11
|
chmod +x wp-cli.phar && \
|
|
12
12
|
mv wp-cli.phar /usr/local/bin/wp
|
|
13
13
|
|
|
14
|
+
# Copy custom.ini
|
|
15
|
+
COPY ./custom.ini /usr/local/etc/php/conf.d/custom.ini
|
|
16
|
+
|
|
14
17
|
# Cleanup apt-get install folders
|
|
15
18
|
RUN apt-get clean && \
|
|
16
19
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
@@ -14,13 +14,13 @@ services:
|
|
|
14
14
|
volumes:
|
|
15
15
|
- mysql:/var/lib/mysql
|
|
16
16
|
wordpress:
|
|
17
|
-
platform: linux/amd64
|
|
18
17
|
build:
|
|
19
|
-
context:
|
|
20
|
-
|
|
21
|
-
image: lab-env
|
|
18
|
+
context: $DIRNAME/wordpress/0
|
|
19
|
+
target: development
|
|
20
|
+
image: fishawack/lab-env-wordpress-0:${FW_WORDPRESS_0_VERSION:-latest}
|
|
22
21
|
networks:
|
|
23
22
|
- default
|
|
23
|
+
user: ${USER_UID:-0}:${USER_GID:-0}
|
|
24
24
|
environment:
|
|
25
25
|
WORDPRESS_DB_NAME: ${DB_DATABASE}
|
|
26
26
|
WORDPRESS_DB_USER: ${DB_USERNAME}
|
|
@@ -33,16 +33,12 @@ services:
|
|
|
33
33
|
WORDPRESS_LOGGED_IN: ${LOGGED_IN}
|
|
34
34
|
WORDPRESS_NONCE_KEY: ${NONCE_KEY}
|
|
35
35
|
WORDPRESS_AUTH_SALT: ${AUTH_SALT}
|
|
36
|
-
WORDPRESS_SECURE_AUTH: ${SECURE_AUTH}
|
|
37
|
-
WORDPRESS_LOGGED_IN: ${LOGGED_IN}
|
|
38
36
|
WORDPRESS_NONCE_SALT: ${NONCE_SALT}
|
|
39
37
|
WORDPRESS_TABLE_PREFIX: ${TABLE_PREFIX}
|
|
40
38
|
WORDPRESS_DEBUG: ${DEBUG}
|
|
41
39
|
WORDPRESS_CONFIG_EXTRA: ${CONFIG_EXTRA}
|
|
42
40
|
volumes:
|
|
43
41
|
- $CWD/:/var/www/html
|
|
44
|
-
- ./apache/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
|
|
45
|
-
- ./apache/.htaccess:/var/www/html/.htaccess
|
|
46
42
|
ports:
|
|
47
43
|
- "${PORT_WEB:-8000}:80"
|
|
48
44
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wordpress",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "lab-env docker config for the wordpress module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"preversion": "docker login",
|
|
7
|
+
"postversion": "docker buildx build --target development --platform linux/amd64,linux/arm64 -t fishawack/lab-env-wordpress-0:$npm_package_version -t fishawack/lab-env-wordpress-0:latest --push . && git add . && git commit -m \"build: Bumped fishawack/lab-env-wordpress-0 to $npm_package_version\""
|
|
8
|
+
},
|
|
9
|
+
"author": "Mike Mellor",
|
|
10
|
+
"license": "ISC"
|
|
11
|
+
}
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
}
|