This is an automated email from the ASF dual-hosted git repository.

zhaocong pushed a commit to branch build_image
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git

commit 8e50f717ee4c8dbab6764820ef7da749540d4b5a
Author: coderzc <[email protected]>
AuthorDate: Mon Dec 5 15:12:43 2022 +0800

    add build image shell
---
 Dockerfile                                        | 48 ++++++-----------------
 hugegraph-dist/src/assembly/travis/build-image.sh | 31 +++++++++++++++
 2 files changed, 44 insertions(+), 35 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index c94f0bbf9..2a33f755e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,54 +15,32 @@
 # limitations under the License.
 #
 
-FROM ubuntu:xenial
+FROM openjdk:11-slim
 
-LABEL maintainer="HugeGraph Docker Maintainers <[email protected]>"
+LABEL maintainer="HugeGraph Docker Maintainers <[email protected]>"
 
-ENV PKG_URL https://github.com/hugegraph
+ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport 
-XX:MaxRAMPercentage=50 -XshowSettings:vm"
 
-# 1. Install needed dependencies of GraphServer & RocksDB
+COPY . /hugegraph/hugegraph-server
+WORKDIR /hugegraph/hugegraph-server
+
+# 1. Install environment
 RUN set -x \
     && apt-get -q update \
     && apt-get -q install -y --no-install-recommends --no-install-suggests \
+       dumb-init \
+       procps \
        curl \
        lsof \
-       g++ \
-       gcc \
-       openjdk-8-jdk \
     && apt-get clean
-    # && rm -rf /var/lib/apt/lists/*
 
 # 2. Init HugeGraph Sever
-# (Optional) You can set the ip of github to speed up the local build
-# && echo "192.30.253.112 github.com\n151.101.44.249 
github.global.ssl.fastly.net" >> /etc/hosts \
-ENV SERVER_VERSION 0.12.0
 RUN set -e \
-    && mkdir -p /root/hugegraph-server \
-    && curl -L -S 
${PKG_URL}/hugegraph/releases/download/v${SERVER_VERSION}/hugegraph-${SERVER_VERSION}.tar.gz
 -o /root/server.tar.gz \
-    && tar xzf /root/server.tar.gz --strip-components 1 -C 
/root/hugegraph-server \
-    && rm /root/server.tar.gz \
-    && cd /root/hugegraph-server/ \
+    && cd /hugegraph/hugegraph-server/ \
     && sed -i "s/^restserver.url.*$/restserver.url=http:\/\/0.0.0.0:8080/g" 
./conf/rest-server.properties \
-    && sed -n '65p' ./bin/start-hugegraph.sh | grep "&" > /dev/null && sed -i 
65{s/\&$/#/g} ./bin/start-hugegraph.sh \
-    && sed -n '75p' ./bin/start-hugegraph.sh | grep "exit" > /dev/null && sed 
-i 75{s/^/#/g} ./bin/start-hugegraph.sh \
     && ./bin/init-store.sh
 
-# 3. Prepare for HugeGraph Studio
-ENV STUDIO_VERSION 0.10.0
-# (Optional) You can set the ip of github to speed up the local build
-# && echo "192.30.253.112 github.com\n151.101.44.249 
github.global.ssl.fastly.net" >> /etc/hosts \
-RUN set -e \
-    && mkdir -p /root/hugegraph-studio \
-    && curl -L -S 
${PKG_URL}/hugegraph-studio/releases/download/v${STUDIO_VERSION}/hugegraph-studio-${STUDIO_VERSION}.tar.gz
 -o /root/studio.tar.gz \
-    && tar xzf /root/studio.tar.gz --strip-components 1 -C 
/root/hugegraph-studio \
-    && rm /root/studio.tar.gz \
-    && cd /root/hugegraph-studio/ \
-    && sed -i "s/^studio.server.host.*$/studio.server.host=0.0.0.0/g" 
./conf/hugegraph-studio.properties \
-    && sed -i "s/^graph.server.host.*$/graph.server.host=0.0.0.0/g" 
./conf/hugegraph-studio.properties
-
-EXPOSE 8080 8088
-WORKDIR /root
-VOLUME /root
+EXPOSE 8080
 
-ENTRYPOINT ["./hugegraph-server/bin/start-hugegraph.sh"]
+ENTRYPOINT [ "/usr/bin/dumb-init", "--" ]
+CMD ["bin/start-hugegraph.sh"]
diff --git a/hugegraph-dist/src/assembly/travis/build-image.sh 
b/hugegraph-dist/src/assembly/travis/build-image.sh
new file mode 100755
index 000000000..a57d7e8e4
--- /dev/null
+++ b/hugegraph-dist/src/assembly/travis/build-image.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+set -ev
+
+BASE_DIR=$(cd "$(dirname "$0")" && pwd -P)
+PROJECT_PATH="$(cd "${BASE_DIR}/../../../.." && pwd -P)"
+PROJECT_POM_PATH="${PROJECT_PATH}/pom.xml"
+
+mvn -f "${PROJECT_POM_PATH}" clean package -DskipTests
+
+CONTEXT_PATH=$(mvn -f "${PROJECT_POM_PATH}" -q -N \
+    org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
+    -Dexec.executable='echo' -Dexec.args='${final.name}')
+    CONTEXT_PATH="${PROJECT_PATH}/${CONTEXT_PATH}"
+
+docker build -t $1 $CONTEXT_PATH -f $PROJECT_PATH/Dockerfile

Reply via email to