Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions builders/_lagoon.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ module.exports = {
const hostnames = _.get(options, '_app.lagoon.containers', []);

// Normalize the dockerfile situation
// We need to do this again since this isnt technically an override
if (_.has(lagoon, 'build.context')) lagoon.build.context = path.join(options.root);
// Resolve build context relative to the project root so non-root contexts
// (eg context: frontend) work correctly instead of always forcing root
if (_.has(lagoon, 'build.context')) {
lagoon.build.context = path.resolve(options.root, lagoon.build.context);
}

// Handle portfoward in the usual way
if (options.portforward) {
Expand Down
10 changes: 10 additions & 0 deletions examples/drupal9-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ docker ps --filter label=com.docker.compose.project | grep Up | grep drupalbase_
docker ps --filter label=com.docker.compose.project | grep Up | grep drupalbase_php_1
docker ps --filter label=com.docker.compose.project | grep Up | grep drupalbase_cli_1

# Should have built nginx and php from the cli image via CLI_IMAGE build arg
cd drupal
lando ssh -s cli -c "test -f /app/web/index.php"
lando ssh -s nginx -c "test -f /app/web/index.php"
lando ssh -s php -c "test -f /app/web/index.php"

# Should not have additional_contexts in the generated compose files
cd drupal
cat ~/.lando/compose/drupalbase-* 2>/dev/null | grep "additional_contexts" && exit 1 || true

# Should ssh against the cli container by default
cd drupal
lando ssh -c "env | grep LAGOON=" | grep cli-drupal
Expand Down
21 changes: 15 additions & 6 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,20 @@ exports.loadConfigFiles = baseDir => {
*/
exports.parseServices = (services, recipeConfig) => _(services)
// Remove unneeded things from the docker config and determine the type of the service
.map((config, name) => _.merge({}, {
name,
type: getLabel(config.labels),
compose: _.omit(config, ['volumes', 'volumes_from', 'networks', 'user']),
config: recipeConfig,
}))
.map((config, name) => {
// Strip additional_contexts from build config since Lando splits services
// into separate compose files and service: refs cant resolve across them
if (_.has(config, 'build.additional_contexts')) {
config = _.cloneDeep(config);
delete config.build.additional_contexts;
}

return _.merge({}, {
name,
type: getLabel(config.labels),
compose: _.omit(config, ['volumes', 'volumes_from', 'networks', 'user']),
config: recipeConfig,
});
})
// Return
.value();
Loading