/
Dockerfile
126 lines (106 loc) · 4.99 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
FROM centos:6.6
MAINTAINER David Cliff <d.cliff@neu.edu>
RUN yum -y install https://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RUN sed -i -e 's/^enabled=0/enabled=1/' /etc/yum.repos.d/CentOS-Vault.repo
RUN yum install java-1.6.0-openjdk java-1.6.0-openjdk-devel --assumeyes
RUN yum install ghostscript --assumeyes
RUN yum install ImageMagick-devel --assumeyes
RUN yum install file-devel --assumeyes
RUN yum install file-libs --assumeyes
RUN yum install sqlite-devel --assumeyes
RUN yum install redis --assumeyes
RUN yum install unzip --assumeyes
RUN yum install zsh --assumeyes
RUN yum install mysql-devel --assumeyes
RUN yum install mysql-server --assumeyes
RUN yum install nodejs --assumeyes
RUN yum install htop --assumeyes
RUN yum install -y patch libyaml-devel gcc-c++ readline-devel libffi-devel bzip2 libtool bison
RUN yum install gcc gettext-devel expat-devel curl-devel zlib-devel openssl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker --assumeyes
RUN yum install wget --assumeyes
RUN yum install fontpackages-filesystem --assumeyes
RUN yum install git --assumeyes
RUN yum install tar --assumeyes
RUN yum install libreoffice-writer-4.0.4.2-9.el6.x86_64 --assumeyes
RUN yum install libreoffice-headless-4.0.4.2-9.el6.x86_64 --assumeyes
RUN yum install sudo --assumeyes
RUN yum install python-setuptools --assumeyes
RUN easy_install supervisor
# Init mysql
RUN /usr/bin/mysql_install_db
# Updating sudoers
RUN echo 'drs ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
# Updating supervisord config
RUN echo_supervisord_conf > /etc/supervisord.conf
RUN sed -i "s/^nodaemon.*/nodaemon=true/" /etc/supervisord.conf
# Updating redis config
RUN sed -i "s/^daemonize.*/daemonize no/" /etc/redis.conf
RUN echo '[program:mysqld]' >> /etc/supervisord.conf
RUN echo 'command=/usr/bin/pidproxy /var/run/mysqld/mysqld.pid /usr/bin/mysqld_safe' >> /etc/supervisord.conf
RUN echo '[program:redis]' >> /etc/supervisord.conf
RUN echo 'command=/usr/sbin/redis-server /etc/redis.conf' >> /etc/supervisord.conf
RUN echo '[program:jetty]' >> /etc/supervisord.conf
RUN echo 'command=/usr/bin/java -Djetty.port=8983 -Dsolr.solr.home=/home/drs/cerberus/jetty/solr -XX:MaxPermSize=128m -Xmx256m -jar start.jar' >> /etc/supervisord.conf
RUN echo 'user=drs' >> /etc/supervisord.conf
RUN echo 'directory=/home/drs/cerberus/jetty' >> /etc/supervisord.conf
RUN echo '[program:rails]' >> /etc/supervisord.conf
RUN echo 'command=/home/drs/.rvm/gems/ruby-2.0.0-p643/wrappers/bundle exec rails server -e %(ENV_RAILS_ENV)s' >> /etc/supervisord.conf
RUN echo 'user=drs' >> /etc/supervisord.conf
RUN echo 'directory=/home/drs/cerberus' >> /etc/supervisord.conf
RUN echo '[program:resque]' >> /etc/supervisord.conf
RUN echo 'command=/home/drs/.rvm/gems/ruby-2.0.0-p643/wrappers/bundle exec resque-pool -p /home/drs/cerberus/tmp/pids/resque-pool.pid' >> /etc/supervisord.conf
RUN echo 'user=drs' >> /etc/supervisord.conf
RUN echo 'directory=/home/drs/cerberus' >> /etc/supervisord.conf
# Making drs user
RUN useradd -ms /bin/zsh drs
RUN chown -R drs:drs /home/drs
USER drs
ENV HOME /home/drs
WORKDIR /home/drs
# Installing RVM
RUN gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
RUN /bin/bash -l -c "curl -sSL https://get.rvm.io | bash -s stable"
RUN /bin/bash -l -c "rvm pkg install libyaml"
RUN /bin/bash -l -c "rvm install ruby-2.0.0-p643"
RUN /bin/bash -l -c "rvm use ruby-2.0.0-p643"
RUN sed -i -e 's/^export PATH="/#export PATH="/' /home/vagrant/.zshrc
RUN echo 'source /home/vagrant/.rvm/scripts/rvm' >> /home/vagrant/.zshrc
# Installing FITS
RUN curl -O http://librarystaff.neu.edu/fits/fits-0.6.2.zip
RUN unzip fits-0.6.2.zip
RUN chmod +x /home/drs/fits-0.6.2/fits.sh
RUN echo 'PATH=$PATH:/opt/fits-0.6.2' >> /home/drs/.bashrc
RUN echo 'export PATH' >> /home/drs/.bashrc
# Installing new file
RUN git clone https://github.com/file/file.git file
RUN cd file && autoreconf -i
RUN cd file && ./configure
RUN cd file && make
RUN cd file && sudo make install
# Installing Oh-My-Zsh
RUN \curl -Lk http://install.ohmyz.sh | sh
# Setting timezone for vm so embargo doesn't get confused
RUN echo 'export TZ=America/New_York' >> /home/drs/.zshrc
RUN echo 'export TZ=America/New_York' >> /home/drs/.bashrc
RUN echo 'source /home/drs/.profile' >> /home/drs/.zshrc
# Moving FITS
USER root
RUN mv /home/drs/fits-0.6.2 /opt/fits-0.6.2
# Adding from src
USER root
ADD / cerberus/
RUN chown -R drs:drs cerberus/
# Kludge for https://github.com/projecthydra/jettywrapper/issues/15
USER drs
RUN rm -rf /home/drs/cerberus/tmp/new-solr-schema.zip
RUN mkdir -p /home/drs/cerberus/tmp \
&& curl -L http://librarystaff.neu.edu/DRSzip/new-solr-schema.zip -o /home/drs/cerberus/tmp/new-solr-schema.zip \
&& unzip /home/drs/cerberus/tmp/new-solr-schema.zip -d /home/drs/cerberus \
&& mv /home/drs/cerberus/hydra-jetty-new-solr-schema /home/drs/cerberus/jetty
# Installing Cerberus
USER drs
RUN /bin/zsh -l -c "/home/drs/cerberus/script/cerberus_setup.sh"
# Run mysql, redis, and rails
USER root
CMD ["/usr/bin/supervisord"]