pngcrush imagemagick \
postgresql-9.2 postgresql-client-9.2 \
postgresql-contrib-9.2 libpq-dev libreadline-dev \
- nginx wget language-pack-en sudo &&\
+ nginx wget language-pack-en sudo cron &&\
dpkg-divert --local --rename --add /sbin/initctl &&\
ln -s /bin/true /sbin/initctl &&\
apt-get install -y redis-server haproxy openssh-server &&\
- echo 'install: --no-ri --no-rdoc' >> ~/.gemrc
- (mkdir /src && cd /src &&\
- git clone https://github.com/sstephenson/ruby-build.git) &&\
- (cd /src/ruby-build && ./install.sh) &&\
+ echo 'install: --no-ri --no-rdoc' >> ~/.gemrc &&\
+ mkdir /src && cd /src &&\
+ git clone https://github.com/sstephenson/ruby-build.git && cd / &&\
+ cd /src/ruby-build &&\
+ ./install.sh && cd / &&\
rm -rf /src/ruby-build &&\
ruby-build 2.0.0-p247 /usr/local &&\
gem update --system &&\
- gem install bundler &&\
+ gem install bundler --pre &&\
useradd discourse &&\
- (mkdir /var/www && cd /var/www &&\
+ mkdir /var/www && cd /var/www &&\
git clone https://github.com/discourse/discourse.git &&\
- chown -R discourse:discourse /var/www/discourse) &&\
- (cd /var/www/discourse &&\
- sudo -u discourse RAILS4=1 bundle install --deployment \
- --without test --without development) &&\
- (cd /var/www/discourse/vendor/bundle &&\
- find . -name tmp -type d | xargs rm -rf) &&\
+ chown -R discourse:discourse /var/www/discourse && cd / &&\
+ cd /var/www/discourse &&\
+ sudo -u discourse RAILS4=1 bundle install -j8 --deployment \
+ --without test --without development && cd / &&\
+ cd /var/www/discourse/vendor/bundle &&\
+ find . -name tmp -type d | xargs rm -rf && cd / &&\
apt-get install -y runit &&\
locale-gen en_US &&\
- apt-get -y autoremove build-essential gcc gcc-4.7 .+-dev &&\
apt-get clean
+# For a smaller but less flexible image:
+# RUN apt-get -y autoremove build-essential gcc gcc-4.7 .+-dev
+
RUN apt-get install psmisc &&\
- (cd / && git clone https://github.com/SamSaffron/pups.git) &&\
+ cd / && git clone https://github.com/SamSaffron/pups.git &&\
apt-get clean
RUN echo image size: $(du -hsx /)
}
set_volumes() {
- volumes=`cat $config_file | docker run -rm -i -a stdout -a stdin samsaffron/discourse ruby -e \
+ volumes=`cat $config_file | docker run -rm -i -a stdout -a stdin $image ruby -e \
"require 'yaml'; puts YAML.load(STDIN.readlines.join)['volumes'].map{|v| '-v ' << v['volume']['host'] << ':' << v['volume']['guest'] << ' '}.join"`
}
case "$command" in
bootstrap)
- template=`cat $config_file | docker run -rm -i -a stdin -a stdout samsaffron/discourse ruby -e \
+ template=`cat $config_file | docker run -rm -i -a stdin -a stdout $image ruby -e \
"require 'yaml'; puts YAML.load(STDIN.readlines.join)['template']"`
input=$(cat $config_file)
set_volumes
- exec echo "$input" | docker run -cidfile $cidbootstrap -i -a stdin -a stdout -a stderr $volumes samsaffron/discourse /pups/bin/pups --stdin
+ exec echo "$input" | docker run -cidfile $cidbootstrap -i -a stdin -a stdout -a stderr $volumes $image /pups/bin/pups --stdin
sleep 5
- docker commit `cat $cidbootstrap` samsaffron/discourse $config
+ docker commit `cat $cidbootstrap` $image $config
docker rm `cat $cidbootstrap` && rm $cidbootstrap
exit 0
;;
if [ ! -e $cidfile ]
then
echo "No cid found, creating a new container"
- ports=`cat $config_file | docker run -rm -i -a stdout -a stdin samsaffron/discourse ruby -e \
+ ports=`cat $config_file | docker run -rm -i -a stdout -a stdin $image ruby -e \
"require 'yaml'; puts YAML.load(STDIN.readlines.join)['expose'].map{|p| '-p ' << p.to_s << ' '}.join"`
set_volumes
- docker run -name $config -cidfile $cidfile $ports -d $volumes samsaffron/discourse:$config /usr/bin/runsvdir -P /etc/service
+ docker run -name $config -cidfile $cidfile $ports -d $volumes $image:$config /usr/bin/runsvdir -P /etc/service
exit 0
else
echo "cid found, ensuring container is started"