Skip to content

Commit

Permalink
Improve base lagoon and lando setup
Browse files Browse the repository at this point in the history
  • Loading branch information
NickDickinsonWilde authored Oct 9, 2024
1 parent da3f4dc commit ef9747d
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 29 deletions.
1 change: 1 addition & 0 deletions assets/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSER_PROJECT_NAME=site-name
7 changes: 7 additions & 0 deletions assets/.lando.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ recipe: lagoon
config:
flavor: drupal
env_file:
- .env
- .lagoon.env

services:
appserver:
webroot: web
type: php:8.2
build_as_root:
- mkdir -p /root/tmp
- chmod 666 /root/tmp
- mkdir -p /app/web/sites/simpletest/browser-output
- chmod 777 -R /app/web/sites/simpletest
- /usr/local/bin/composer self-update
overrides:
environment:
PHP_IDE_CONFIG: serverName=localhost
Expand Down
4 changes: 2 additions & 2 deletions assets/.lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ config:

tooling:
npm:
service: nodebuilder
service: cli
cmd: npm
dir: /app/web/themes/SITENAME
gulp:
service: nodebuilder
service: cli
cmd: gulp
dir: /app/web/themes/SITENAME
23 changes: 8 additions & 15 deletions assets/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ x-volumes:
x-environment:
&default-environment
# Route that should be used locally, if you are using pygmy, this route *must* end with .docker.amazee.io
LAGOON_ROUTE: &default-url http://SITENAME.docker.amazee.io
COMPOSER_VERSION: '2.0.4'
COMPOSER_HASH_SHA256: '1cdc74f74965908d0e98d00feeca37c23b86da51170a3a11a1538d89ff44d4dd'
LAGOON_ROUTE: &default-url http://${COMPOSE_PROJECT_NAME:-taoti-amazee}.docker.amazee.io
# Uncomment if you like to have the system behave like in production
#LAGOON_ENVIRONMENT_TYPE: production
# Uncomment to enable xdebug and then restart via `docker-compose up -d`
Expand All @@ -34,7 +32,7 @@ services:
build:
context: .
dockerfile: lagoon/cli.dockerfile
image: &cli-image SITENAME-cli # this image will be reused as `CLI_IMAGE` in subsequent Docker builds
image: &cli-image ${COMPOSE_PROJECT_NAME:-taoti-amazee}.-cli # this image will be reused as `CLI_IMAGE` in subsequent Docker builds
labels:
# Lagoon Labels
lagoon.type: cli-persistent
Expand Down Expand Up @@ -92,7 +90,7 @@ services:
<< : *default-environment # loads the defined environment variables from the top

mariadb:
image: uselagoon/mariadb-drupal:latest
image: uselagoon/mysql-8.0:latest
labels:
lagoon.type: mariadb
lando.type: mariadb-drupal
Expand All @@ -101,16 +99,9 @@ services:
<< : *default-user # uses the defined user from top
environment:
<< : *default-environment

nodebuilder:
env_file:
- .lagoon.env
profiles:
- nodebuilder # setup a profile so that the node builder doesn't run by default
image: uselagoon/node-14-builder
labels:
lagoon.type: none
<< : *default-volumes # loads the defined volumes from the top
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal

redis:
image: amazeeio/redis:6-latest
Expand All @@ -135,6 +126,8 @@ services:
- cli
environment:
<< : *default-environment
volumes:
- search:/var/solr

networks:
amazeeio-network:
Expand Down
10 changes: 5 additions & 5 deletions assets/lagoon/cli.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM uselagoon/node-14-builder:latest as nodebuilder
FROM uselagoon/node-20-builder:latest AS nodebuilder
COPY . /app
RUN cd /app/web/themes/SITENAME && npm install --no-ansi && npx gulp --no-ansi
RUN cd /app/web/themes/SITENAME && npm ci --no-ansi && npm run gulp --no-ansi

FROM uselagoon/php-8.2-cli-drupal:latest
RUN apk add screen

FROM uselagoon/php-7.4-cli-drupal:latest
COPY --from=nodebuilder /app /app
RUN COMPOSER_MEMORY_LIMIT=-1 composer global remove hirak/prestissimo
RUN COMPOSER_MEMORY_LIMIT=-1 composer self-update --2
RUN COMPOSER_MEMORY_LIMIT=-1 composer install --no-interaction --no-progress --optimize-autoloader --no-dev --no-ansi
RUN mkdir -p -v -m766 /app/web/sites/default/files/private
RUN chmod 444 /app/web/sites/default/settings.php
Expand Down
2 changes: 1 addition & 1 deletion assets/lagoon/drush-override.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Lagoon global drush.yml file
# This file tells Drush 9 about the lagoon environment
# This file tells Drush about the lagoon environment

options:
root: '/app/${env.WEBROOT}'
Expand Down
2 changes: 1 addition & 1 deletion assets/lagoon/nginx.dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG CLI_IMAGE
FROM ${CLI_IMAGE} as cli
FROM ${CLI_IMAGE} AS cli

FROM uselagoon/nginx-drupal:latest

Expand Down
2 changes: 1 addition & 1 deletion assets/lagoon/php.dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG CLI_IMAGE
FROM ${CLI_IMAGE} as cli
FROM ${CLI_IMAGE} AS cli

FROM uselagoon/php-8.2-fpm:latest

Expand Down
4 changes: 1 addition & 3 deletions assets/lagoon/solr.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
ARG CLI_IMAGE
FROM ${CLI_IMAGE} as cli

# Inspired by https://github.com/uselagoon/lagoon-images/pull/97
FROM ${CLI_IMAGE} AS cli

FROM uselagoon/solr-8-drupal:latest
COPY --from=cli /app/config/solr-conf/ /solr-conf/conf
Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@
"mode": "replace",
"path": "assets/docker-compose.yml",
"overwrite": false
}
},
"[project-root]/.env": {
"mode": "replace",
"path": "assets/.env",
"overwrite": false
},
}
}
}
Expand Down

0 comments on commit ef9747d

Please sign in to comment.