-
Notifications
You must be signed in to change notification settings - Fork 0
/
.lando.yml
66 lines (66 loc) · 3.06 KB
/
.lando.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: lando-wp-site-template
recipe: wordpress
excludes: # these folders will not be synched to host, improving performance
- wp-content/themes/lando-wp-site-theme/node_modules
# - wp-content/themes/lando-wp-site-theme/vendor
- wp-content/vendor
# - wp-content/uploads
# - wp-content/plugins
config:
webroot: .
via: nginx
xdebug: true
services:
appserver: # php docker
composer_version: 2.2.18
run:
- composer install
- rm -rf $LANDO_MOUNT/wp/wp-content # wp-content is in another 🏰
# - cd $LANDO_MOUNT/wp-content/themes/lando-wp-site-theme && composer install
database:
build:
- chmod +x $LANDO_MOUNT/sh-scripts/import-db-on-start.sh && $LANDO_MOUNT/sh-scripts/import-db-on-start.sh
portforward: 32862 # always use the same port for convenience when connecting externally (eg. with Sequel Ace)
node: # custom name of an additional Docker container
type: node:16
overrides:
ports: [3334:3334]
build_as_root:
## - echo 'Installing php to the NodeJS container for php linting...' # we need this for theme php linting
## - apt-get update -y && apt-get install -y php7.3 php7.3-xml
run:
# - cd $LANDO_MOUNT/wp-content/themes/lando-wp-site-theme && npm install && npm run build
tooling: # commands available from outside (lando <command>)
npm:
service: node
cmd: npm
dir: /app/wp-content/themes/lando-wp-site-theme # must be an absolute path, can't use a $LANDO_ like constant here
watch:
description: Serve theme in a watch mode using Vite. While serving, we add a file marker communicating to PHP that HMR is ongoing. If the marker file does not exist, then Vite JS entry point script is not loaded to PHP and instead regular production assets are loaded
service: node
cmd: |
touch $LANDO_MOUNT/.vite-hmr && echo 'Adding .vite-hmr, HMR is on'
trap 'rm -f $LANDO_MOUNT/.vite-hmr && echo "\nDeleting .vite-hmr, HMR is off"' INT
npm run start
dir: /app/wp-content/themes/lando-wp-site-theme
build:
service: node
cmd: cd $LANDO_MOUNT/wp-content/themes/lando-wp-site-theme && npm run build
regenerate:
service: appserver
cmd: wp media regenerate --yes
wpinstall:
service: appserver
cmd: 'wp core install --url=http://$LANDO_APP_NAME.$LANDO_DOMAIN --title=WPTemplate --admin_user=admin --admin_password=password [email protected] && wp plugin activate --all && wp theme install twentytwentythree --activate'
events:
pre-start:
- node: ln -s $LANDO_MOUNT/wp-content/themes/lando-wp-site-theme/public/assets $LANDO_MOUNT/assets
# @todo. Will produce a warning when destroying the app after it has been stopped (still produces a backup when stopping. As a solution, destroy before stopping or stop, then destroy)
pre-stop:
- database: /helpers/sql-export.sh $LANDO_MOUNT/sql-dumps/${MYSQL_DATABASE}.`date +"%Y-%m-%d-%s"`.sql
- node: rm -rf $LANDO_MOUNT/assets
env_file: # env variables can only be used inside Docker, not inside this .lando.yml file
- .env
proxy:
node:
- vite.lando-wp-site-template.lndo.site:3000