forked from tyrex-team/sparqlgx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
67 lines (55 loc) · 2.41 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
# Use testing to have a compatible version of OCaml
FROM debian:stretch
LABEL maintainer thomas.calmant@inria.fr
# Ensure a sane environment
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 DEBIAN_FRONTEND=noninteractive
# Add support for HTTPS in aptitude
# and install Java 8, Scala and OCaml
RUN set -x && \
apt update --fix-missing && \
apt install -y apt-transport-https ocaml-nox opam m4 && \
apt install -y --no-install-recommends curl vim openjdk-8-jdk-headless && \
echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 && \
apt update && \
apt install -y sbt && \
apt clean
# Image configuration
ARG HADOOP_VERSION=2.7.7
ENV HADOOP_URL https://www.apache.org/dist/hadoop/common/hadoop-$HADOOP_VERSION/hadoop-$HADOOP_VERSION.tar.gz
# Install Hadoop
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
RUN set -x && \
curl -fSL -o - "$HADOOP_URL" | tar xz -C /opt/ && \
ln -s /opt/hadoop-$HADOOP_VERSION/etc/hadoop /etc/hadoop && \
cp /etc/hadoop/mapred-site.xml.template /etc/hadoop/mapred-site.xml && \
mkdir /opt/hadoop-$HADOOP_VERSION/logs
# Update environment
ENV HADOOP_PREFIX=/opt/hadoop-$HADOOP_VERSION \
HADOOP_CONF_DIR=/etc/hadoop
# Add SparqlGX
COPY . /opt/sparqlgx
WORKDIR /opt/sparqlgx
# Install Spark
RUN . /opt/sparqlgx/conf/compilation.conf && \
curl -fSL -o - http://d3kbcqa49mib13.cloudfront.net/spark-${SPARK_VERSION}-bin-hadoop2.7.tgz | tar xz -C /opt && \
ln -s /opt/spark-${SPARK_VERSION}-bin-hadoop2.7 /opt/spark
# Change user
RUN useradd sparqlgx --home-dir /opt/sparqlgx && \
chown -R sparqlgx: /opt/sparqlgx
USER sparqlgx
# Install Menhir
RUN opam init -a && \
echo ". /opt/sparqlgx/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true" > ~/.bashrc && \
eval $(opam config env) && \
opam install -y menhir yojson
# Ensure that bash is the default shell
ENV SHELL=/bin/bash
# Compile and add SparqlGX to the path
RUN eval `opam config env` && \
bash compile.sh && \
ln -s /opt/sparqlgx/bin/sparqlgx.sh /opt/sparqlgx/bin/sparqlgx && \
chmod +x /opt/sparqlgx/bin/sparqlgx.sh && sync
ENV PATH=/opt/sparqlgx/bin:/opt/spark/bin:$HADOOP_PREFIX/bin:$PATH
# Adding a bit of documentation when a user launches interactively the image
RUN echo "\n. /opt/sparqlgx/launch-message-for-docker.sh\n" >> /opt/sparqlgx/.bashrc