Dockerfile 5.04 KB
Newer Older
1
2
3
#
# Create a reproducible installation of the RNAcentral website.
#
Anton Petrov's avatar
Anton Petrov committed
4
# All local dependencies are installed manually to mirror the production setup
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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 \
Anton Petrov's avatar
Anton Petrov committed
18
    openssl \
19
20
21
22
23
24
25
    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

ENV LOC /rnacentral/local

# Install Python
31
# NOTE: Python-2.7.11 and python-2.7.11 are DIFFERENT folders, the former contains the sources, the later - binaries
32
33
RUN \
    cd $LOC && \
Anton Petrov's avatar
Anton Petrov committed
34
35
36
37
    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/ && \
38
39
40
41
42
    export LD_RUN_PATH=$PREFIX/lib && \
    ./configure --prefix=$PREFIX  --enable-shared && \
    make && \
    make install && \
    cd $LOC && \
Anton Petrov's avatar
Anton Petrov committed
43
44
    rm -Rf Python-2.7.11 && \
    rm Python-2.7.11.tgz
45
46
47
48

# Install virtualenv
RUN \
    cd $LOC && \
Anton Petrov's avatar
Anton Petrov committed
49
50
51
    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
52
    $LOC/python-2.7.11/bin/python setup.py install && \
53
    cd $LOC && \
Anton Petrov's avatar
Anton Petrov committed
54
55
    rm -Rf virtualenv-15.0.0.tar.gz && \
    rm -Rf virtualenv-15.0.0
56
57
58
59
60
61

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

# 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

Anton Petrov's avatar
Anton Petrov committed
101
# Create a user for memcached
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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 && \
123
    curl -L -o mod_wsgi-3.4.tar.gz https://github.com/GrahamDumpleton/mod_wsgi/archive/3.4.tar.gz && \
124
125
    tar -zxvf mod_wsgi-3.4.tar.gz && \
    cd mod_wsgi-3.4 && \
126
    export LD_RUN_PATH=$LOC/python-2.7.11/lib && \
Anton Petrov's avatar
Anton Petrov committed
127
128
    export LD_LIBRARY_PATH=$LOC/python-2.7.11/lib/:$LD_LIBRARY_PATH && \
    ./configure --with-python=$LOC/python-2.7.11/bin/python && \
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
    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 && \
Anton Petrov's avatar
Anton Petrov committed
167
    supervisord -c $RNACENTRAL_HOME/supervisor/supervisor.conf && \
168
    python $RNACENTRAL_HOME/rnacentral/manage.py runserver 0.0.0.0:8000