Dockerfile 1.1 KB

12345678910111213141516171819202122232425
  1. FROM wordpress:apache
  2. RUN \
  3. #
  4. # Install sendmail
  5. apt-get update \
  6. && apt-get install -y --no-install-recommends sendmail \
  7. && rm -rf /var/lib/apt/lists/* \
  8. #
  9. # Configure php to use sendmail
  10. && echo "sendmail_path=sendmail -t -i" >> /usr/local/etc/php/conf.d/sendmail.ini \
  11. #
  12. # Create script to use as new entrypoint, which
  13. # 1. Creates a localhost entry for container hostname in /etc/hosts
  14. # 2. Restarts sendmail to discover this entry
  15. # 3. Calls original docker-entrypoint.sh
  16. && echo '#!/bin/bash' >> /usr/local/bin/docker-entrypoint-wrapper.sh \
  17. && echo 'set -euo pipefail' >> /usr/local/bin/docker-entrypoint-wrapper.sh \
  18. && echo 'echo "127.0.0.1 $(hostname) localhost localhost.localdomain" >> /etc/hosts' >> /usr/local/bin/docker-entrypoint-wrapper.sh \
  19. && echo 'service sendmail restart' >> /usr/local/bin/docker-entrypoint-wrapper.sh \
  20. && echo 'exec docker-entrypoint.sh "$@"' >> /usr/local/bin/docker-entrypoint-wrapper.sh \
  21. && chmod +x /usr/local/bin/docker-entrypoint-wrapper.sh
  22. ENTRYPOINT ["docker-entrypoint-wrapper.sh"]
  23. CMD ["apache2-foreground"]