mirror of
https://github.com/opdavies/build-configs.git
synced 2025-02-02 05:47:32 +00:00
feat: add project_root
setting
Allow for overriding the project root from `/app` to something else, such as `/var/www/html`. The default is set within a new `build.defaults.yaml` file which the project specific file is merged into. Fixes #27
This commit is contained in:
parent
eeeb70df14
commit
6b5c1b5aee
1
resources/build.defaults.yaml
Normal file
1
resources/build.defaults.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
project_root: /app
|
|
@ -55,7 +55,10 @@ final class BuildConfigurationCommand extends Command
|
|||
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
$configurationData = Yaml::parseFile($configFile);
|
||||
$configurationData = array_merge(
|
||||
Yaml::parseFile(__DIR__.'/../../../resources/build.defaults.yaml'),
|
||||
Yaml::parseFile($configFile),
|
||||
);
|
||||
|
||||
$violations = $this->configurationValidator->validate($configurationData);
|
||||
|
||||
|
|
|
@ -37,6 +37,11 @@ final class ConfigurationValidator implements ValidatorInterface
|
|||
new Assert\Choice(['drupal-project', 'php-library']),
|
||||
],
|
||||
|
||||
'project_root' => [
|
||||
new Assert\NotNull(),
|
||||
new Assert\Type('string'),
|
||||
],
|
||||
|
||||
'database' => new Assert\Optional(),
|
||||
|
||||
'drupal' => new Assert\Optional(),
|
||||
|
|
|
@ -8,14 +8,14 @@ RUN which composer && composer -V
|
|||
ARG DOCKER_UID=1000
|
||||
ENV DOCKER_UID="${DOCKER_UID}"
|
||||
|
||||
WORKDIR /app
|
||||
WORKDIR {{ project_root }}
|
||||
|
||||
RUN adduser --disabled-password --uid "${DOCKER_UID}" app \
|
||||
&& chown app:app -R /app
|
||||
&& chown app:app -R {{ project_root }}
|
||||
|
||||
USER app
|
||||
|
||||
ENV PATH="${PATH}:/app/bin:/app/vendor/bin"
|
||||
ENV PATH="${PATH}:{{ project_root }}/bin:{{ project_root }}/vendor/bin"
|
||||
|
||||
COPY --chown=app:app composer.* ./
|
||||
|
||||
|
@ -78,7 +78,7 @@ RUN {% for command in dockerfile.stages.test.commands -%}
|
|||
|
||||
FROM caddy:2 as web
|
||||
|
||||
WORKDIR /app
|
||||
WORKDIR {{ project_root }}
|
||||
|
||||
COPY tools/docker/images/web/root /
|
||||
{% endif %}
|
||||
|
@ -90,7 +90,7 @@ FROM nginx:1 as web
|
|||
|
||||
EXPOSE 8080
|
||||
|
||||
WORKDIR /app
|
||||
WORKDIR {{ project_root }}
|
||||
|
||||
COPY tools/docker/images/web/root /
|
||||
{% endif %}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
x-app: &default-app
|
||||
volumes:
|
||||
- "${DOCKER_WEB_VOLUME:-./{{ drupal.docroot }}:/app/{{ drupal.docroot }}}"
|
||||
- "${DOCKER_WEB_VOLUME:-./{{ drupal.docroot }}:{{ project_root }}/{{ drupal.docroot }}}"
|
||||
env_file:
|
||||
- .env
|
||||
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
|
||||
|
|
|
@ -6,7 +6,7 @@ export DOCKER_UID=1000
|
|||
export COMPOSE_PROJECT_NAME={{ name }}
|
||||
export COMPOSE_PROFILES=web,php,database
|
||||
|
||||
export DOCKER_WEB_VOLUME=.:/app
|
||||
export DOCKER_WEB_VOLUME=.:{{ project_root }}
|
||||
{% endif %}
|
||||
|
||||
{% if "drupal-project" == type %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# {{ managedText | raw }}
|
||||
|
||||
:80
|
||||
root * /app/{{ drupal.docroot }}
|
||||
root * {{ project_root }}/{{ drupal.docroot }}
|
||||
file_server
|
||||
php_fastcgi php:9000
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
server {
|
||||
server_name _;
|
||||
|
||||
root /app/{{ drupal.docroot }};
|
||||
root {{ project_root }}/{{ drupal.docroot }};
|
||||
|
||||
location / {
|
||||
try_files $uri /index.php?$query_string;
|
||||
|
|
Loading…
Reference in a new issue