FROM 3share/base:latest

LABEL Vendor="3Share" \
      Maintainer="Gordon Pike"

RUN yum -y --setopt=tsflags=nodocs update && \
    yum -y --setopt=tsflags=nodocs install httpd

ARG PUBLISH_HOST
ENV PUBLISH_HOST ${PUBLISH_HOST:-publish}

EXPOSE 80 443 4502 4503

# Simple startup script to avoid some issues observed with container restart
ADD run-httpd.sh /run-httpd.sh
RUN chmod -v +x /run-httpd.sh

# Create Ansible Repo directory and clone repo
# RUN ANSIBLE for AEM installation
RUN /usr/bin/ansible-playbook -e "linked_publisher_ip=${PUBLISH_HOST}" -i /data/apps/build/inventory/ -l localhost /data/apps/build/playbooks/docker_dispatch.yml

# Start Apache
CMD /run-httpd.sh
