-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
49 lines (40 loc) · 3.68 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
FROM jboss/base-jdk:8
ENV JANUSGRAPH_VERSION=0.3.1
ENV JANUSGRAPH_TYPE=socket
ENV JANUSGRAPH_HOME /usr/local/janusgraph
# Conditional COPY/ADD in Dockerfile? https://stackoverflow.com/questions/31528384/conditional-copy-add-in-dockerfile
COPY docker-compose.yml janusgraph-${JANUSGRAPH_VERSION}-hadoop2.zi[p] /tmp/
# https://github.com/yhwang/docker-janusgraph/blob/034176944e1bfa2dbd44c14cd20473a35419321c/janusgraph/Dockerfile this Dockerfile also compile janusgraph
# https://github.com/channelit/docker-images/blob/master/janusgraph/Dockerfile
# https://blog.yiz96.com/janusgraph-setup/ how to edit conf files for hbase
RUN \
test -f /tmp/janusgraph-${JANUSGRAPH_VERSION}-hadoop2.zip \
|| yum install wget &&\
test -f /tmp/janusgraph-${JANUSGRAPH_VERSION}-hadoop2.zip \
|| wget https://github.com/JanusGraph/janusgraph/releases/download/v$JANUSGRAPH_VERSION/janusgraph-$JANUSGRAPH_VERSION-hadoop2.zip -O /tmp/janusgraph-${JANUSGRAPH_VERSION}-hadoop2.zip &&\
mkdir -p $JANUSGRAPH_HOME &&\
cd $JANUSGRAPH_HOME &&\
unzip /tmp/janusgraph-${JANUSGRAPH_VERSION}-hadoop2.zip -d $JANUSGRAPH_HOME &&\
rm /tmp/janusgraph-${JANUSGRAPH_VERSION}-hadoop2.zip &&\
rm /tmp/docker-compose.yml &&\
ln -s $JANUSGRAPH_HOME/janusgraph-${JANUSGRAPH_VERSION}-hadoop2 $JANUSGRAPH_HOME/janusgraph &&\
cd $JANUSGRAPH_HOME/janusgraph &&\
cp conf/janusgraph-hbase-es.properties conf/gremlin-server/janusgraph-hbase-es-server.properties &&\
sed -E -i '1igremlin.graph=org.janusgraph.core.JanusGraphFactory\' conf/gremlin-server/janusgraph-hbase-es-server.properties &&\
sed -E -i 's/storage\.hostname=.*$/storage\.hostname=hbase-server/' conf/gremlin-server/janusgraph-hbase-es-server.properties &&\
sed -E -i 's/index\.search\.hostname=.*$/index\.search\.hostname=es-server/' conf/gremlin-server/janusgraph-hbase-es-server.properties &&\
cp conf/gremlin-server/gremlin-server.yaml conf/gremlin-server/socket-hbase-es-server.yaml &&\
sed -E -i 's/janusgraph-cql-es-server/janusgraph-hbase-es-server/' conf/gremlin-server/socket-hbase-es-server.yaml &&\
cp conf/gremlin-server/gremlin-server.yaml conf/gremlin-server/http-hbase-es-server.yaml &&\
sed -E -i 's/janusgraph-cql-es-server/janusgraph-hbase-es-server/' conf/gremlin-server/http-hbase-es-server.yaml &&\
sed -E -i 's/channel\.WebSocketChannelizer/channel\.HttpChannelizer/' conf/gremlin-server/http-hbase-es-server.yaml &&\
cp conf/gremlin-server/gremlin-server.yaml conf/gremlin-server/both-hbase-es-server.yaml &&\
sed -E -i 's/janusgraph-cql-es-server/janusgraph-hbase-es-server/' conf/gremlin-server/both-hbase-es-server.yaml &&\
sed -E -i 's/channel\.WebSocketChannelizer/channel\.WsAndHttpChannelizer/' conf/gremlin-server/both-hbase-es-server.yaml
EXPOSE 8182
VOLUME $JANUSGRAPH_HOME/janusgraph/conf/gremlin-server
VOLUME $JANUSGRAPH_HOME/janusgraph/scripts
WORKDIR $JANUSGRAPH_HOME/janusgraph
# How can I use a variable inside a Dockerfile CMD? https://stackoverflow.com/questions/40454470/how-can-i-use-a-variable-inside-a-dockerfile-cmd
# Dockerfile if else condition with external arguments https://stackoverflow.com/questions/43654656/dockerfile-if-else-condition-with-external-arguments
CMD if [ "x$JANUSGRAPH_TYPE" = "console" ] ; then bin/gremlin.sh ; else ./bin/gremlin-server.sh ./conf/gremlin-server/${JANUSGRAPH_TYPE}-hbase-es-server.yaml ; fi