Commit 523ebf3e authored by Jürgen Haas's avatar Jürgen Haas

Add support for proper source paths when using GitLab CI

parent 5034427b
......@@ -199,6 +199,7 @@ class Handler extends BaseHandler {
$extra = $this->composer->getPackage()->getExtra() + ['docker4drupal' => []];
$options = NestedArray::mergeDeep([
'projectname' => $projectname,
'ci_home' => '/home/gitlab-runner',
'docker0' => [
'ip' => $this->getLocalIpv4('docker0'),
],
......@@ -275,6 +276,16 @@ class Handler extends BaseHandler {
'enable' => 0,
],
], $extra['docker4drupal']);
$projectRoot = getenv('CI_PROJECT_DIR');
if (empty($projectRoot)) {
$projectRoot = '.';
}
else {
$projectRoot = $options['ci_home'] . $projectRoot;
}
$options['projectroot'] = $projectRoot;
return $env->replaceEnvironmentVariables($options);
}
......
......@@ -42,8 +42,8 @@ services:
SSH_AUTH_SOCK: /ssh-agent
{% endif %}
volumes:
- ./:/var/www/html
- ./drush:/etc/drush
- {{ projectroot }}/:/var/www/html
- {{ projectroot }}/drush:/etc/drush
{% if php.ssh %}
- $SSH_AUTH_SOCK:/ssh-agent
{% endif %}
......@@ -78,7 +78,7 @@ services:
{{ webserver.type|upper }}_BACKEND_HOST: php
{{ webserver.type|upper }}_SERVER_ROOT: /var/www/html/{{ webRoot }}
volumes:
- ./:/var/www/html
- {{ projectroot }}/:/var/www/html
labels:
traefik.backend: '{{ projectname }}_{{ webserver.type }}_1'
traefik.port: '80'
......@@ -154,7 +154,7 @@ services:
traefik.port: '8080'
traefik.frontend.rule: 'Host:nodejs.{{ projectname }}.docker.localhost'
volumes:
- ./{{ node.path }}:/app
- {{ projectroot }}/{{ node.path }}:/app
command: sh -c 'npm install && npm run start'
node:
......@@ -167,7 +167,7 @@ services:
expose:
- '3000'
volumes:
- ./{{ node.path }}:/app
- {{ projectroot }}/{{ node.path }}:/app
command: sh -c 'npm install && npm run start'
{% endif %}
{% if memcached.enable %}
......@@ -212,7 +212,7 @@ services:
traefik.port: '8080'
traefik.frontend.rule: 'Host:webgrind.{{ projectname }}.docker.localhost'
volumes:
- files:/mnt/files
- {{ projectroot }}/files:/mnt/files
{% endif %}
hub:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment