Skip to content

Commit

Permalink
feat: allow overriding env vars at build time (#10)
Browse files Browse the repository at this point in the history
- Update default values for FILES_DIR, APP_ROOT, DOCROOT_SUBDIR, and
  DRUPAL_SITE in drupal-cron, drupal-tailscale, and drupal-php Dockerfiles.
  • Loading branch information
esolitos authored Jun 5, 2024
1 parent f6eb409 commit 48994eb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
13 changes: 9 additions & 4 deletions templates/drupal-cron/default.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ COPY --chown=1000:1000 ${COPY_FROM} ${COPY_TO}
COPY ${COPY_FROM}/infrastructure/docker/drupal-cron/www-data.crontab /etc/crontabs/www-data

# Define our default values for environment variables, those can be overridden at runtime.
ENV FILES_DIR=/mnt/files
ENV APP_ROOT=/var/www/html
ENV DOCROOT_SUBDIR=drupal
ARG FILES_DIR=/mnt/files
ARG APP_ROOT=/var/www/html
ARG DOCROOT_SUBDIR=drupal
ARG DRUPAL_SITE=default

ENV DRUPAL_SITE=default
ENV FILES_DIR=${FILES_DIR}
ENV APP_ROOT=${APP_ROOT}
ENV DOCROOT_SUBDIR=${DOCROOT_SUBDIR}

ENV DRUPAL_SITE=${DRUPAL_SITE}
ENV DRUPAL_ROOT=${APP_ROOT}/${DOCROOT_SUBDIR}
ENV DRUPAL_SITE_DIR=${DRUPAL_ROOT}/sites/${DRUPAL_SITE}
ENV DRUPAL_FILES_DIR=${DRUPAL_SITE_DIR}/files
Expand Down
13 changes: 9 additions & 4 deletions templates/drupal-php/default.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ ARG COPY_TO=.
COPY --chown=1000:1000 ${COPY_FROM} ${COPY_TO}

# Define our default values for environment variables, those can be overridden at runtime.
ENV FILES_DIR=/mnt/files
ENV APP_ROOT=/var/www/html
ENV DOCROOT_SUBDIR=drupal
ARG FILES_DIR=/mnt/files
ARG APP_ROOT=/var/www/html
ARG DOCROOT_SUBDIR=drupal
ARG DRUPAL_SITE=default

ENV DRUPAL_SITE=default
ENV FILES_DIR=${FILES_DIR}
ENV APP_ROOT=${APP_ROOT}
ENV DOCROOT_SUBDIR=${DOCROOT_SUBDIR}

ENV DRUPAL_SITE=${DRUPAL_SITE}
ENV DRUPAL_ROOT=${APP_ROOT}/${DOCROOT_SUBDIR}
ENV DRUPAL_SITE_DIR=${DRUPAL_ROOT}/sites/${DRUPAL_SITE}
ENV DRUPAL_FILES_DIR=${DRUPAL_SITE_DIR}/files
Expand Down
14 changes: 10 additions & 4 deletions templates/drupal-tailscale/default.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@ ARG COPY_TO=.
COPY --chown=1000:1000 ${COPY_FROM} ${COPY_TO}

# Define our default values for environment variables, those can be overridden at runtime.
ENV FILES_DIR=/mnt/files
ENV APP_ROOT=/var/www/html
ENV DOCROOT_SUBDIR=drupal
ARG FILES_DIR=/mnt/files
ARG APP_ROOT=/var/www/html
ARG DOCROOT_SUBDIR=drupal
ARG DRUPAL_SITE=default

ENV DRUPAL_SITE=default
ENV FILES_DIR=${FILES_DIR}
ENV APP_ROOT=${APP_ROOT}
ENV DOCROOT_SUBDIR=${DOCROOT_SUBDIR}

ENV DRUPAL_SITE=${DRUPAL_SITE}
ENV DRUPAL_ROOT=${APP_ROOT}/${DOCROOT_SUBDIR}
ENV DRUPAL_SITE_DIR=${DRUPAL_ROOT}/sites/${DRUPAL_SITE}
ENV DRUPAL_FILES_DIR=${DRUPAL_SITE_DIR}/files
ENV DRUPAL_FILES_SYNC_SALT=not-in-use-but-required
ENV DRUPAL_PHP_STORAGE_DIR=/tmp/php

USER root

Expand Down

0 comments on commit 48994eb

Please sign in to comment.