FROM ubuntu:14.04.4 MAINTAINER Liz Lam ENV P4PORT 0.0.0.0:1666 ENV JAMBOX_HOME /var/www/jambox # Install dependencies RUN apt-get update && apt-get install -y \ wget \ libapache2-mod-php5 \ php5-dev # Add files ADD ./registered.txt /registered.txt ADD ./protect.txt /protect.txt ADD ./perforce.ini /etc/php5/mods-available/perforce.ini ADD ./000-default.conf /etc/apache2/sites-available/000-default.conf ADD ./start.sh /start.sh # Get p4d and p4 and move to appropriate location RUN wget ftp://ftp.perforce.com/perforce/r15.2/bin.linux26x86_64/p4; \ wget ftp://ftp.perforce.com/perforce/r15.2/bin.linux26x86_64/p4d; \ chmod +x p4; \ chmod +x p4d; \ mv p4 /usr/local/bin; \ mv p4d /usr/local/bin # Start p4d, sync JamBox source from Workshop, configure server RUN mkdir -p /opt/perforce/p4server/; \ p4d -r /opt/perforce/p4server -p 0.0.0.0:1666 -d; \ p4 depot -o guest | p4 depot -i; \ p4 depot -o .swarm | p4 depot -i; \ p4 group -i < registered.txt; \ p4 -d /var/www/jambox -u guest clone -p workshop.perforce.com:1666 -f //guest/thomas_gray/jambox/main/...; \ chown www-data:www-data $JAMBOX_HOME/swarm/data/; \ $JAMBOX_HOME/swarm/p4-bin/scripts/swarm-trigger.sh -o > swarm-triggers.txt; \ p4 triggers -o > default-triggers.txt; \ cat default-triggers.txt swarm-triggers.txt > final.txt; \ p4 triggers -i < final.txt; \ p4 protect -i < protect.txt; \ p4 -u perforce configure set server.allowfetch=2; \ p4 -u perforce configure set server.allowpush=2 # Add config.php file needed for Swarm/JamBox ADD ./config.php $JAMBOX_HOME/swarm/data/config.php # Turn on rewrite module and suppress apache2 warning (Could not reliably determine the server's fully...) RUN a2enmod rewrite; \ echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf; \ sudo a2enconf fqdn # Setup token in triggers RUN sed -i 's/SWARM_TOKEN=\"\"/SWARM_TOKEN=\"$(echo trigger_token.txt)\"/g' /var/www/jambox/swarm/p4-bin/scripts/swarm-trigger.sh; # Link Perforce/Swarm ini file RUN ln -s /etc/php5/mods-available/perforce.ini /etc/php5/apache2/conf.d/20-perforce.ini # Setup Workers (Needed for Activity stream) RUN echo "* * * * * nobody /usr/bin/wget -q -O /dev/null -T5 http://localhost/queue/worker" > /etc/cron.d/swarm EXPOSE 1666 80 CMD ["/bin/bash", "/start.sh"]