xref: /OpenGrok/Dockerfile (revision 6670a14a36ea109ec939466c66e877471dcbfba8)
1*6670a14aSVladimir KotalFROM debian:stable-slim as fetcher
2*6670a14aSVladimir Kotal
3*6670a14aSVladimir Kotal# TODO copy just the 'distribution' directory, not all source code
4*6670a14aSVladimir KotalCOPY ./ /opengrok-source
5*6670a14aSVladimir KotalWORKDIR /opengrok-source
6*6670a14aSVladimir Kotal
7*6670a14aSVladimir Kotal# update the system
8*6670a14aSVladimir KotalRUN apt-get update
9*6670a14aSVladimir Kotal
10*6670a14aSVladimir Kotal# find most recent package file
11*6670a14aSVladimir KotalRUN cp `ls -t distribution/target/*.tar.gz | head -n1 |awk '{printf("%s",$0)}'` /opengrok.tar.gz
12*6670a14aSVladimir Kotal
13*6670a14aSVladimir KotalFROM tomcat:9-jre8
14*6670a14aSVladimir KotalLABEL maintainer "opengrok-dev@yahoogroups.com"
15*6670a14aSVladimir Kotal
16*6670a14aSVladimir Kotal# prepare OpenGrok binaries and directories
17*6670a14aSVladimir KotalCOPY --from=fetcher opengrok.tar.gz /opengrok.tar.gz
18*6670a14aSVladimir KotalRUN mkdir -p /opengrok /var/opengrok/etc /opengrok/data /opengrok/src && \
19*6670a14aSVladimir Kotal    tar -zxvf /opengrok.tar.gz -C /opengrok --strip-components 1 && \
20*6670a14aSVladimir Kotal    rm -f /opengrok.tar.gz
21*6670a14aSVladimir Kotal
22*6670a14aSVladimir Kotal# install dependencies and Python tools
23*6670a14aSVladimir KotalRUN apt-get update && apt-get install -y git subversion mercurial unzip inotify-tools python3 python3-pip python3-venv && \
24*6670a14aSVladimir Kotal    python3 -m pip install /opengrok/tools/opengrok-tools*
25*6670a14aSVladimir Kotal
26*6670a14aSVladimir Kotal# compile and install universal-ctags
27*6670a14aSVladimir KotalRUN apt-get install -y pkg-config autoconf build-essential && git clone https://github.com/universal-ctags/ctags /root/ctags && \
28*6670a14aSVladimir Kotal    cd /root/ctags && ./autogen.sh && ./configure && make && make install && \
29*6670a14aSVladimir Kotal    apt-get remove -y autoconf build-essential && apt-get -y autoremove && apt-get -y autoclean && \
30*6670a14aSVladimir Kotal    cd /root && rm -rf /root/ctags
31*6670a14aSVladimir Kotal
32*6670a14aSVladimir Kotal# environment variables
33*6670a14aSVladimir KotalENV SRC_ROOT /opengrok/src
34*6670a14aSVladimir KotalENV DATA_ROOT /opengrok/data
35*6670a14aSVladimir KotalENV OPENGROK_WEBAPP_CONTEXT /
36*6670a14aSVladimir KotalENV OPENGROK_TOMCAT_BASE /usr/local/tomcat
37*6670a14aSVladimir KotalENV CATALINA_HOME /usr/local/tomcat
38*6670a14aSVladimir KotalENV PATH $CATALINA_HOME/bin:$PATH
39*6670a14aSVladimir KotalENV CATALINA_BASE /usr/local/tomcat
40*6670a14aSVladimir KotalENV CATALINA_HOME /usr/local/tomcat
41*6670a14aSVladimir KotalENV CATALINA_TMPDIR /usr/local/tomcat/temp
42*6670a14aSVladimir KotalENV JRE_HOME /usr
43*6670a14aSVladimir KotalENV CLASSPATH /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
44*6670a14aSVladimir Kotal
45*6670a14aSVladimir Kotal# custom deployment to / with redirect from /source
46*6670a14aSVladimir KotalRUN rm -rf /usr/local/tomcat/webapps/* && \
47*6670a14aSVladimir Kotal    opengrok-deploy /opengrok/lib/source.war /usr/local/tomcat/webapps/ROOT.war && \
48*6670a14aSVladimir Kotal    mkdir "/usr/local/tomcat/webapps/source" && \
49*6670a14aSVladimir Kotal    echo '<% response.sendRedirect("/"); %>' > "/usr/local/tomcat/webapps/source/index.jsp"
50*6670a14aSVladimir Kotal
51*6670a14aSVladimir Kotal# disable all file logging
52*6670a14aSVladimir KotalADD docker/logging.properties /usr/local/tomcat/conf/logging.properties
53*6670a14aSVladimir KotalRUN sed -i -e 's/Valve/Disabled/' /usr/local/tomcat/conf/server.xml
54*6670a14aSVladimir Kotal
55*6670a14aSVladimir Kotal# add our scripts
56*6670a14aSVladimir KotalADD docker /scripts
57*6670a14aSVladimir KotalRUN chmod -R +x /scripts
58*6670a14aSVladimir Kotal
59*6670a14aSVladimir Kotal# run
60*6670a14aSVladimir KotalWORKDIR $CATALINA_HOME
61*6670a14aSVladimir KotalEXPOSE 8080
62*6670a14aSVladimir KotalCMD ["/scripts/start.sh"]
63