Skip to content
Snippets Groups Projects
Commit 523ebf3e authored by jurgenhaas's avatar jurgenhaas
Browse files

Add support for proper source paths when using GitLab CI

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