# 
# Installs WordPress with wp-cli (wp.cli.org)
# Docker Hub: https://registry.hub.docker.com/u/conetix/wordpress-with-wp-cli/
# Github Repo: https://github.com/conetix/docker-wordpress-wp-cli

FROM wordpress:php8.2-apache
ARG BASEDIR

# Install sudo in order to run wp-cli as the www-data user 
# install mysql client, text editors
RUN apt-get update && apt-get install -y sudo less default-mysql-client nano vim unzip

# Install WP-CLI 
RUN curl -o /bin/wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
COPY wp-su.sh /bin/wp
RUN chmod +x /bin/wp-cli.phar /bin/wp

# Cleanup
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Copy modified ini file to be able to use mailcatcher smtp server
# sendmail_path = /usr/bin/env catchmail -f wordpress@local.test
COPY php.ini-development /usr/local/etc/php

# Copy apache conf file
COPY ./conf/000-default.conf  /etc/apache2/sites-available/000-default.conf
