ARG phpversion='8.4'
ARG drupalversion='11.x-dev'
ARG postgresqlversion='17'
FROM tripalproject/tripaldocker-drupal:drupal${drupalversion}-php${phpversion}-pgsql${postgresqlversion}

## Redefine the core args so that they are within the build scope.
ARG phpversion='8.4'
ARG drupalversion='11.x-dev'
ARG postgresqlversion='17'

## Update our path so that drush can be found.
ENV PATH="/var/www/drupal/vendor/drush/drush:$PATH"

## Ensure that postgresql is ready to accept connections.
HEALTHCHECK --interval=2m --timeout=30s --start-period=2m --retries=3 CMD [ "pg_isready", "-U", "postgres" ]

## Copy the module code into the appropriate location.
COPY . /var/www/drupal/web/modules/contrib/olivero_dark_switch

## Enable the module using drush.
RUN service apache2 start \
  && service postgresql start \
  && drush en olivero_dark_switch devel -y \
  && drush config-set system.site name "Drupal ${drupalversion} Testing Docker" \
  && service apache2 stop \
  && service postgresql stop
