Skip to content

Commit

Permalink
[#1328] Added support for custom configuration location via `DRUPAL_C…
Browse files Browse the repository at this point in the history
…ONFIG_PATH`.
  • Loading branch information
tannguyen04 authored and AlexSkrypnyk committed Jun 4, 2024
1 parent efb3308 commit 0121bbf
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .docker/cli.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ ENV DRUPAL_PRIVATE_FILES=${DRUPAL_PRIVATE_FILES}
ARG DRUPAL_TEMPORARY_FILES="${TMP:-/tmp}"
ENV DRUPAL_TEMPORARY_FILES=${DRUPAL_TEMPORARY_FILES}

ARG DRUPAL_CONFIG_PATH="/app/config/default"
ENV DRUPAL_CONFIG_PATH=${DRUPAL_CONFIG_PATH}

# Set default values for environment variables.
# These values will be overridden if set in docker-compose.yml or .env file
# during build stage.
Expand Down Expand Up @@ -95,8 +98,8 @@ RUN npm --prefix /app/${WEBROOT}/themes/custom/your_site_theme ci --no-audit --n
COPY . /app

# Create files directories and set correct permissions.
RUN mkdir -p "${DRUPAL_PUBLIC_FILES}" "${DRUPAL_PRIVATE_FILES}" "${DRUPAL_TEMPORARY_FILES}" && \
chmod 0770 "${DRUPAL_PUBLIC_FILES}" "${DRUPAL_PRIVATE_FILES}" "${DRUPAL_TEMPORARY_FILES}"
RUN mkdir -p "${DRUPAL_PUBLIC_FILES}" "${DRUPAL_PRIVATE_FILES}" "${DRUPAL_TEMPORARY_FILES}" "${DRUPAL_CONFIG_PATH}" && \
chmod 0770 "${DRUPAL_PUBLIC_FILES}" "${DRUPAL_PRIVATE_FILES}" "${DRUPAL_TEMPORARY_FILES}" "${DRUPAL_CONFIG_PATH}"

# Compile front-end assets. Running this after copying all files as we need
# sources to compile assets.
Expand Down
8 changes: 8 additions & 0 deletions .scaffold/tests/bats/fixtures/docker-compose.env.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -70,6 +71,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -118,6 +120,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -173,6 +176,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -209,6 +213,7 @@
"build": {
"args": {
"CLI_IMAGE": "star_wars",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_TEMPORARY_FILES": "/tmp",
Expand All @@ -228,6 +233,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -290,6 +296,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -362,6 +369,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down
8 changes: 8 additions & 0 deletions .scaffold/tests/bats/fixtures/docker-compose.env_local.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -70,6 +71,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -118,6 +120,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -173,6 +176,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -209,6 +213,7 @@
"build": {
"args": {
"CLI_IMAGE": "star_wars",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_TEMPORARY_FILES": "/tmp",
Expand All @@ -228,6 +233,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -290,6 +296,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down Expand Up @@ -362,6 +369,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "0",
Expand Down
8 changes: 8 additions & 0 deletions .scaffold/tests/bats/fixtures/docker-compose.env_mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "1",
Expand Down Expand Up @@ -70,6 +71,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "1",
Expand Down Expand Up @@ -118,6 +120,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "1",
Expand Down Expand Up @@ -173,6 +176,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "1",
Expand Down Expand Up @@ -209,6 +213,7 @@
"build": {
"args": {
"CLI_IMAGE": "the_matrix",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_TEMPORARY_FILES": "/tmp",
Expand All @@ -228,6 +233,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "1",
Expand Down Expand Up @@ -290,6 +296,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "1",
Expand Down Expand Up @@ -362,6 +369,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "the_matrix.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "1",
Expand Down
8 changes: 8 additions & 0 deletions .scaffold/tests/bats/fixtures/docker-compose.noenv.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "",
Expand Down Expand Up @@ -70,6 +71,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "",
Expand Down Expand Up @@ -118,6 +120,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "",
Expand Down Expand Up @@ -173,6 +176,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "",
Expand Down Expand Up @@ -209,6 +213,7 @@
"build": {
"args": {
"CLI_IMAGE": "star_wars",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_TEMPORARY_FILES": "/tmp",
Expand All @@ -228,6 +233,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "",
Expand Down Expand Up @@ -290,6 +296,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "",
Expand Down Expand Up @@ -362,6 +369,7 @@
"environment": {
"CI": "true",
"DREVOPS_LOCALDEV_URL": "star_wars.docker.amazee.io",
"DRUPAL_CONFIG_PATH": "/app/config/default",
"DRUPAL_PRIVATE_FILES": "/app/web/sites/default/files/private",
"DRUPAL_PUBLIC_FILES": "/app/web/sites/default/files",
"DRUPAL_REDIS_ENABLED": "",
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ x-environment: &default-environment
CI: ${CI:-}
# Forward emails to Mailhog locally.
SSMTP_MAILHUB: ${SSMTP_MAILHUB:-host.docker.internal:1025}
# Path to configuration files.
DRUPAL_CONFIG_PATH: ${DRUPAL_CONFIG_PATH:-/app/config/default}
# Drupal file paths.
DRUPAL_PUBLIC_FILES: ${DRUPAL_PUBLIC_FILES:-/app/web/sites/default/files}
DRUPAL_PRIVATE_FILES: ${DRUPAL_PRIVATE_FILES:-/app/web/sites/default/files/private}
Expand Down Expand Up @@ -114,6 +116,7 @@ services:
args:
CLI_IMAGE: *cli-image
WEBROOT: "${DREVOPS_WEBROOT:-web}"
DRUPAL_CONFIG_PATH: ${DRUPAL_CONFIG_PATH:-/app/config/default}
DRUPAL_PUBLIC_FILES: ${DRUPAL_PUBLIC_FILES:-/app/web/sites/default/files}
DRUPAL_PRIVATE_FILES: ${DRUPAL_PRIVATE_FILES:-/app/web/sites/default/files/private}
DRUPAL_TEMPORARY_FILES: ${DRUPAL_TEMPORARY_FILES:-/tmp}
Expand Down
Loading

1 comment on commit 0121bbf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.