Blame view

docker/Dockerfile 4.74 KB
Matthijs Brouwer authored
1
# Automatically generated Dockerfile 
Matthijs Brouwer authored
2
# - Build 2017-05-11 09:13
Matthijs Brouwer authored
3
# - Lucene/Solr version 6.5.1
Matthijs Brouwer authored
4
# - Mtas release 20170505 
Matthijs Brouwer authored
5
6
7
#

FROM ubuntu:16.04
Matthijs Brouwer authored
8
MAINTAINER Matthijs Brouwer, Meertens Institute
Matthijs Brouwer authored
9
10
11

EXPOSE 8983 80
Matthijs Brouwer authored
12
USER root
Matthijs Brouwer authored
13
14
15

WORKDIR "/root" 
Matthijs Brouwer authored
16
RUN mkdir lib 
Matthijs Brouwer authored
17
Matthijs Brouwer authored
18
ADD https://github.com/meertensinstituut/mtas/releases/download/20170505/mtas-6.5.1.jar /root/lib/
Matthijs Brouwer authored
19
Matthijs Brouwer authored
20
21
22
23
RUN apt-get update && apt-get install -y lsof software-properties-common python-software-properties apache2 curl subversion && \
    locale-gen en_US.UTF-8 en_US && update-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en

RUN mathurl=$(curl -s 'http://www.apache.org/dyn/closer.lua/commons/math/binaries/commons-math3-3.6.1-bin.tar.gz' |   grep -o '<strong>[^<]*</strong>' |   sed 's/<[^>]*>//g' |   head -1) && \
Matthijs Brouwer authored
24
25
26
    if [[ $mathurl = *[!\ ]* ]]; then \
      curl -f -o /root/lib/commons-math3-3.6.1-bin.tar.gz -O $mathurl; \
    fi && \
Matthijs Brouwer authored
27
28
29
30
31
32
33
34
35
    if [ ! -f /root/lib/commons-math3-3.6.1-bin.tar.gz ]; then \
      echo "Commons-math3 not found in mirror, falling back to apache archive"; \ 
      mathurl="http://archive.apache.org/dist/commons/math/binaries/commons-math3-3.6.1-bin.tar.gz"; \
      curl -f -o /root/lib/commons-math3-3.6.1-bin.tar.gz -O $mathurl; \
    fi && \ 
    tar xzf lib/commons-math3-3.6.1-bin.tar.gz -C lib commons-math3-3.6.1/commons-math3-3.6.1.jar --strip-components=1 && \
    rm lib/commons-math3-3.6.1-bin.tar.gz

RUN svn export https://github.com/meertensinstituut/mtas/trunk/docker/ data
Matthijs Brouwer authored
36
Matthijs Brouwer authored
37
38
39
40
41
RUN add-apt-repository -y ppa:webupd8team/java && \
    apt-get update && \
    echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \
    apt-get install -y oracle-java8-installer && \
    rm -rf /var/lib/apt/lists/*
Matthijs Brouwer authored
42
Matthijs Brouwer authored
43
44
45
46
47
48
49
50
RUN solrurl=$(curl -s 'http://www.apache.org/dyn/closer.lua/lucene/solr/6.5.1/solr-6.5.1.tgz' |   grep -o '<strong>[^<]*</strong>' |   sed 's/<[^>]*>//g' |   head -1) && \
    if [[ $solrurl = *[!\ ]* ]]; then \
      curl -f -o /root/solr-6.5.1.tgz -O $solrurl; \
    fi && \
    if [ ! -f /root/solr-6.5.1.tgz ]; then \
      echo "Solr 6.5.1 not found in mirror, falling back to apache archive"; \ 
      solrurl="http://archive.apache.org/dist/lucene/solr/6.5.1/solr-6.5.1.tgz"; \
      curl -f -o /root/solr-6.5.1.tgz -O $solrurl; \ 
Matthijs Brouwer authored
51
    fi && \    
Matthijs Brouwer authored
52
53
    tar xzf solr-6.5.1.tgz solr-6.5.1/bin/install_solr_service.sh --strip-components=2 && \
    bash ./install_solr_service.sh solr-6.5.1.tgz && rm install_solr_service.sh && rm -rf solr-6.5.1.tgz
Matthijs Brouwer authored
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

RUN service apache2 stop && \
    echo "ServerName localhost" | tee /etc/apache2/conf-available/fqdn.conf && \
    a2enmod proxy && \
    a2enmod proxy_http && \
    a2enmod proxy_ajp && \
    a2enmod rewrite && \
    a2enmod deflate && \
    a2enmod headers && \
    a2enmod proxy_balancer && \
    a2enmod proxy_connect && \
    a2enmod proxy_html && \
    a2enmod xml2enc && \
    a2enconf fqdn && \
    sed -i '/<\/VirtualHost>/ i ProxyPass /solr http://localhost:8983/solr\nProxyPassReverse /solr http://localhost:8983/solr' /etc/apache2/sites-enabled/000-default.conf && \
    rm -rf /var/www/html/* && \
    mkdir /var/www/html/demo && \
    cp -rp data/*-samples /var/www/html/demo/ && \
    gunzip -r /var/www/html/demo && \
    cp -rp data/site/* /var/www/html && \
    chmod -R 755 /var/www/html && \
    printf "echo\n" >> /start.sh && \
    printf "echo \"================ Mtas -- Multi Tier Annotation Search =================\"\n" >> /start.sh && \
Matthijs Brouwer authored
77
    printf "echo \"  Timestamp 2017-05-11 09:13\"\n" >> /start.sh && \
Matthijs Brouwer authored
78
    printf "echo \"  Lucene/Solr version 6.5.1\"\n" >> /start.sh && \
Matthijs Brouwer authored
79
    printf "echo \"  Mtas release 20170505\"\n" >> /start.sh && \
Matthijs Brouwer authored
80
81
82
83
84
85
86
87
    printf "echo \"  See https://meertensinstituut.github.io/mtas/ for more information\"\n" >> /start.sh && \
    printf "echo \"=======================================================================\"\n" >> /start.sh && \
    printf "echo\n" >> /start.sh && \
    printf "service solr start\nservice apache2 start\n" >> /start.sh && \
    chmod 755 /start.sh && \
    mkdir demo1 && mkdir demo1/lib && mkdir demo1/conf && \
    echo "name=demo1" > demo1/core.properties && \
    cp lib/commons-math3-3.6.1.jar demo1/lib/ && \
Matthijs Brouwer authored
88
    cp lib/mtas-6.5.1.jar demo1/lib/ && \
Matthijs Brouwer authored
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
    cp data/solrconfig.xml demo1/conf/ && \
    cp data/schemaBasic.xml demo1/conf/schema.xml && \
    cp -r data/mtas demo1/conf/ && cp data/mtas.xml demo1/conf/ && \
    chmod -R 777 demo1 && \
    cp -rp demo1 demo2 && \
    cp data/schemaFull.xml demo2/conf/schema.xml && \
    echo "name=demo2" > demo2/core.properties && \
    cp -rp demo1 demo3 && \
    cp data/schemaFull.xml demo3/conf/schema.xml && \
    echo "name=demo3" > demo3/core.properties && \
    mv demo1 /var/solr/data/ && \
    mv demo2 /var/solr/data/ && \
    mv demo3 /var/solr/data/

CMD bash -C '/start.sh'; 'bash'