Dockerfile 4.91 KB
Newer Older
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
#
# Create a reproducible installation of the RNAcentral website.
#
# All local dependencies are installed manually to mirror the production setup 
# where Docker or yum are not available.
#

FROM centos:6.6

RUN yum install -y \
    curl \
    gcc \
    git \
    httpd \
    httpd-devel \
    libaio \
    nc.x86_64 \
    openssl \ 
    openssl-devel \
    tar \
    unzip \
    zlib-devel

RUN mkdir /rnacentral
RUN mkdir /rnacentral/local
Anton Petrov's avatar
Anton Petrov committed
26
RUN mkdir /rnacentral/static
27
28
29
30
31
32

ENV LOC /rnacentral/local

# Install Python
RUN \
    cd $LOC && \
Anton Petrov's avatar
Anton Petrov committed
33
34
35
36
    curl -OL http://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz && \
    tar -zxvf Python-2.7.11.tgz && \
    cd Python-2.7.11 && \
    PREFIX=$LOC/python-2.7.11/ && \
37
38
39
40
41
    export LD_RUN_PATH=$PREFIX/lib && \
    ./configure --prefix=$PREFIX  --enable-shared && \
    make && \
    make install && \
    cd $LOC && \
Anton Petrov's avatar
Anton Petrov committed
42
43
    rm -Rf Python-2.7.11 && \
    rm Python-2.7.11.tgz
44
45
46
47

# Install virtualenv
RUN \
    cd $LOC && \
Anton Petrov's avatar
Anton Petrov committed
48
49
50
    curl -OL  https://pypi.python.org/packages/source/v/virtualenv/virtualenv-15.0.0.tar.gz && \
    tar -zxvf virtualenv-15.0.0.tar.gz && \
    cd virtualenv-15.0.0 && \
Anton Petrov's avatar
Anton Petrov committed
51
    $LOC/python-2.7.11/bin/python setup.py install && \
52
    cd $LOC && \
Anton Petrov's avatar
Anton Petrov committed
53
54
    rm -Rf virtualenv-15.0.0.tar.gz && \
    rm -Rf virtualenv-15.0.0
55
56
57
58
59
60

# Create RNAcentral virtual environment
RUN \
    cd $LOC && \
    mkdir virtualenvs && \
    cd virtualenvs && \
Anton Petrov's avatar
Anton Petrov committed
61
    $LOC/python-2.7.11/bin/virtualenv RNAcentral --python=$LOC/python-2.7.11/bin/python
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

# Install Redis
RUN \
    cd $LOC && \
    curl -OL http://download.redis.io/redis-stable.tar.gz && \
    tar -xvzf redis-stable.tar.gz && \
    cd redis-stable && \
    make && \
    cd $LOC && \
    rm redis-stable.tar.gz && \
    mv redis-stable redis

# Install libevent (memcached requirement)
RUN \
    cd $LOC && \
    curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz && \
    tar -zxvf libevent-2.0.21-stable.tar.gz && \
    cd libevent-2.0.21-stable && \
    ./configure --prefix=$LOC/libevent && \
    make && \
    make install && \
    cd $LOC && \
    rm -Rf libevent-2.0.21-stable && \
    rm libevent-2.0.21-stable.tar.gz

# Install memcached (requires libevent)
RUN \
    cd $LOC && \
    curl -OL  http://www.memcached.org/files/memcached-1.4.17.tar.gz && \
    tar -zxvf memcached-1.4.17.tar.gz && \
    cd memcached-1.4.17 && \
    ./configure --prefix=$LOC/memcached --with-libevent=$LOC/libevent/ && \
    make && \
    make install && \
    cd $LOC && \
    rm -Rf memcached-1.4.17 && \
    rm memcached-1.4.17.tar.gz

# Create a user for memcached 
RUN adduser -g root xfm_adm

# Install Infernal
RUN \
    cd $LOC && \
    curl -OL http://eddylab.org/infernal/infernal-1.1.1.tar.gz && \
    tar -xvzf infernal-1.1.1.tar.gz && \
    cd infernal-1.1.1 && \
    ./configure --prefix=$LOC/infernal-1.1.1 && \
    make && \
    make install && \
    cd easel && \
    make install && \
    cd $LOC && \
    rm infernal-1.1.1.tar.gz

# Install mod_wsgi
RUN \
    cd $LOC && \
    mkdir httpd && \
    mkdir httpd/modules && \
    curl -OL https://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz && \
    tar -zxvf mod_wsgi-3.4.tar.gz && \
    cd mod_wsgi-3.4 && \
125
    export LD_RUN_PATH=$LOC/python-2.7.11/lib && \
Anton Petrov's avatar
Anton Petrov committed
126
127
    export LD_LIBRARY_PATH=$LOC/python-2.7.11/lib/:$LD_LIBRARY_PATH && \
    ./configure --with-python=$LOC/python-2.7.11/bin/python && \
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
    make && \
    mv .libs/mod_wsgi.so $LOC/httpd/modules && \
    cd $LOC && \
    rm -Rf mod_wsgi-3.4 && \
    rm mod_wsgi-3.4.tar.gz

# Install Oracle Instant Client
RUN \
    cd $LOC && \
    curl -OL https://www.dropbox.com/s/iyguhv6qxluw2nv/instantclient-basic-linux.x64-12.1.0.2.0.zip?dl=1 && \
    curl -OL https://www.dropbox.com/s/eaqyop7m4dukkbi/instantclient-sdk-linux.x64-12.1.0.2.0.zip?dl=1 && \
    mv instantclient-basic-linux.x64-12.1.0.2.0.zip?dl=1 instantclient-basic-linux.x64-12.1.0.2.0.zip && \
    mv instantclient-sdk-linux.x64-12.1.0.2.0.zip?dl=1 instantclient-sdk-linux.x64-12.1.0.2.0.zip && \
    unzip instantclient-basic-linux.x64-12.1.0.2.0.zip && \
    unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip && \
    rm *.zip && \
    ln -s $LOC/instantclient_12_1/libclntsh.so.12.1 $LOC/instantclient_12_1/libclntsh.so

ENV ORACLE_HOME $LOC/instantclient_12_1
ENV LD_LIBRARY_PATH $LOC/instantclient_12_1

# Define container environment variables
ENV RNACENTRAL_HOME /rnacentral/rnacentral-webcode
ENV RNACENTRAL_LOCAL /rnacentral/local

# Install Django requirements
ADD rnacentral/requirements.txt $RNACENTRAL_HOME/rnacentral/
RUN \
    source $LOC/virtualenvs/RNAcentral/bin/activate && \
    export LD_RUN_PATH=$LOC/instantclient_12_1 && \
    pip install -r $RNACENTRAL_HOME/rnacentral/requirements.txt

# Expose a container port where the website is served
EXPOSE 8000

# Start up the app
ENTRYPOINT \
    source $LOC/virtualenvs/RNAcentral/bin/activate && \
    supervisord -c $RNACENTRAL_HOME/supervisor/supervisor.conf && \    
    python $RNACENTRAL_HOME/rnacentral/manage.py runserver 0.0.0.0:8000