Skip to content

Commit

Permalink
feat: configure Drupal file paths in Nginx Dockerfile (#11)
Browse files Browse the repository at this point in the history
This change sets up the default environment variables and file paths for a Drupal
application running in an Nginx container. It creates a symlink to the default
location where the persistent files are stored, which is usually done at runtime
by calling the makefiles script. This change ensures that the file paths are
properly configured without having to run the script every time the container
is started.
  • Loading branch information
esolitos authored Jun 5, 2024
1 parent 48994eb commit 00bab4e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions templates/nginx/default.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,29 @@ ARG COPY_FROM=.
ARG COPY_TO=.
COPY --chown=1000:1000 ${COPY_FROM} ${COPY_TO}

# Define our default values for environment variables, those can be overridden at runtime.
ARG FILES_DIR=/mnt/files
ARG APP_ROOT=/var/www/html
ARG DOCROOT_SUBDIR=drupal
ARG 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

# Creates a symlink to the default location where the persistent files are stored.
#
# This is usually done at runtime by calling the makefiles script, but to avoid
# having to run the script every time the container is started, we do it here for
# the default location.
RUN set -e ;\
rm -rvf "${DRUPAL_FILES_DIR}" ;\
ln -vs "${FILES_DIR}/public" "${DRUPAL_FILES_DIR}"

# Copy error template
COPY ${COPY_FROM}/infrastructure/docker/nginx/50x.html.tmpl /etc/gotpl/50x.html.tmpl

0 comments on commit 00bab4e

Please sign in to comment.