FROM drupal:11.4-php8.4-apache-trixie@sha256:62d1fda516cd2a59c52beee5f516c90ddda8103a02d4c6d317215e2209333d94

ARG SOURCE_REVISION=unknown

LABEL org.opencontainers.image.source="https://git.drupalcode.org/project/postfix_admin_console" \
  org.opencontainers.image.licenses="GPL-2.0-or-later" \
  org.opencontainers.image.title="Postfix Admin Console Docker demo" \
  org.opencontainers.image.description="Disposable Drupal demo for evaluating the Postfix Admin Console Recipe" \
  org.opencontainers.image.revision="${SOURCE_REVISION}" \
  org.opencontainers.image.vendor="Pixie Works" \
  org.opencontainers.image.documentation="https://project.pages.drupalcode.org/postfix_admin_console/docker-demo/"

WORKDIR /opt/drupal

COPY composer.json composer.lock ./

RUN composer install --no-dev --no-interaction --no-progress --prefer-dist \
  && composer require --no-interaction --no-progress --prefer-dist \
    drupal/postfix_admin_console:1.0.0-alpha2 \
  && echo '29a9866f289c1d33258ec100e8ed07a1bf8a094d299493e17ff8f8c288e92b34  composer.json' | sha256sum --check --strict \
  && echo 'ba7e88b03494b3486ad019029ec0dc507fea8072efa5d30656992fd19842693c  composer.lock' | sha256sum --check --strict \
  && composer clear-cache

COPY postfix-admin-console-entrypoint postfix-admin-console-first-install postfix-admin-console-healthcheck /usr/local/bin/

RUN chmod 0755 \
    /usr/local/bin/postfix-admin-console-entrypoint \
    /usr/local/bin/postfix-admin-console-first-install \
    /usr/local/bin/postfix-admin-console-healthcheck

HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=5 CMD ["/usr/local/bin/postfix-admin-console-healthcheck"]

ENTRYPOINT ["/usr/local/bin/postfix-admin-console-entrypoint"]
CMD ["apache2-foreground"]
