cp /var/www/discourse/config/environments/production.rb.sample /var/www/discourse/config/environments/production.rb
-
+RUN apt-get install -y runit &&\
+ mkdir -p /etc/service/sshd &&\
+ mkdir -p /var/run/sshd &&\
+ echo "#!/bin/sh" > /etc/service/sshd/run &&\
+ echo "exec 2>&1" >> /etc/service/sshd/run &&\
+ echo "exec /usr/sbin/sshd -D -e" >> /etc/service/sshd/run &&\
+ mkdir -p /root/.ssh &&\
+ chmod +x /etc/service/sshd/run
# RUN cd /var/www/discourse && bundle exec rake db:test:prepare && bundle exec rspec
config=$2
config_file=shared/config/"$config"/conf.yml
cidfile=cids/"$config".cid
+cidbootstrap=cids/"$config"_boostrap.cid
image=samsaffron/discourse
[ $# -ne 2 ] && {
echo "Usage: launcher COMMAND CONFIG"
echo "Commands:"
- echo " start: Start/initialize a container"
- echo " stop: Stop a running container"
- echo " restart: Restart a container"
- echo " destroy: Stop and remove a container"
- echo " shell: start a bash shell in a running container"
- echo " logs: Docker logs for container"
+ echo " start: Start/initialize a container"
+ echo " stop: Stop a running container"
+ echo " restart: Restart a container"
+ echo " destroy: Stop and remove a container"
+ echo " shell: Start a bash shell in a running container"
+ echo " logs: Docker logs for container"
+ echo " bootstrap: Bootstrap a container for the config base on an image"
exit 1
}
exit 1
fi
+if [ "$command" == "bootstrap" ]
+ then
+ docker run -cidfile $cidbootstrap -i -t -v `pwd`/shared:/shared samsaffron/discourse /shared/pups/bin/pups /$config_file
+ docker commit `cat $cidbootstrap` samsaffron/discourse $config
+ docker rm `cat $cidbootstrap`
+ rm $cidbootstrap
+fi
+
if [ "$command" == "shell" ]
then
if [ ! -e $cidfile ]
then
echo "No cid found, creating a new container"
- docker run -cidfile $cidfile -p 22 -p 3000 -d -v `pwd`/shared:/shared samsaffron/discourse /shared/pups/bin/pups /$config_file
+ docker run -cidfile $cidfile -p 22 -p 3000 -d -v `pwd`/shared:/shared samsaffron/discourse:$config /usr/bin/runsvdir -P /etc/service
exit 0
else
echo "cid found, ensuring container is started"