From c715ff0ef9fe937808d7726813df7eb1f2bb4ed9 Mon Sep 17 00:00:00 2001 From: VGalaxies Date: Sun, 21 Apr 2024 19:01:44 +0800 Subject: [PATCH] intro docker for pd & store --- hugegraph-pd/Dockerfile | 58 +++++++++++++++++++ .../hg-pd-dist/docker/docker-entrypoint.sh | 22 +++++++ hugegraph-store/Dockerfile | 58 +++++++++++++++++++ .../hg-store-dist/docker/docker-entrypoint.sh | 22 +++++++ 4 files changed, 160 insertions(+) create mode 100644 hugegraph-pd/Dockerfile create mode 100644 hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh create mode 100644 hugegraph-store/Dockerfile create mode 100644 hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh diff --git a/hugegraph-pd/Dockerfile b/hugegraph-pd/Dockerfile new file mode 100644 index 0000000000..e1b2b12829 --- /dev/null +++ b/hugegraph-pd/Dockerfile @@ -0,0 +1,58 @@ +# +# 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. +# + +# Dockerfile for HugeGraph PD +# 1st stage: build source code (refer to hugegraph-server/Dockerfile) + +# 2nd stage: runtime env +# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 +FROM openjdk:11-slim + +COPY --from=build /pkg/hugegraph-pd/dist/hugegraph-pd-*/ /hugegraph-pd/ +LABEL maintainer="HugeGraph Docker Maintainers " + +# TODO: use g1gc or zgc as default +ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" \ + HUGEGRAPH_HOME="hugegraph-pd" + +#COPY . /hugegraph/hugegraph-pd +WORKDIR /hugegraph-pd/ + +# 1. Install environment and init HugeGraph Sever +RUN set -x \ + && apt-get -q update \ + && apt-get -q install -y --no-install-recommends --no-install-suggests \ + dumb-init \ + procps \ + curl \ + lsof \ + vim \ + cron \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && service cron start \ + && pwd && cd /hugegraph-pd/ + +# 2. Init docker script +COPY hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh . +RUN chmod 755 ./docker-entrypoint.sh + +EXPOSE 8620 +VOLUME /hugegraph-server + +ENTRYPOINT ["/usr/bin/dumb-init", "--"] +CMD ["./docker-entrypoint.sh"] diff --git a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh new file mode 100644 index 0000000000..fd894d5518 --- /dev/null +++ b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/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. +# + +# start hugegraph pd +./bin/start-hugegraph-pd.sh -j "$JAVA_OPTS" + +tail -f /dev/null diff --git a/hugegraph-store/Dockerfile b/hugegraph-store/Dockerfile new file mode 100644 index 0000000000..0e7a333963 --- /dev/null +++ b/hugegraph-store/Dockerfile @@ -0,0 +1,58 @@ +# +# 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. +# + +# Dockerfile for HugeGraph Store +# 1st stage: build source code (refer to hugegraph-server/Dockerfile) + +# 2nd stage: runtime env +# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 +FROM openjdk:11-slim + +COPY --from=build /pkg/hugegraph-store/dist/hugegraph-store-*/ /hugegraph-store/ +LABEL maintainer="HugeGraph Docker Maintainers " + +# TODO: use g1gc or zgc as default +ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" \ + HUGEGRAPH_HOME="hugegraph-store" + +#COPY . /hugegraph/hugegraph-store +WORKDIR /hugegraph-store/ + +# 1. Install environment and init HugeGraph Sever +RUN set -x \ + && apt-get -q update \ + && apt-get -q install -y --no-install-recommends --no-install-suggests \ + dumb-init \ + procps \ + curl \ + lsof \ + vim \ + cron \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && service cron start \ + && pwd && cd /hugegraph-store/ + +# 2. Init docker script +COPY hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh . +RUN chmod 755 ./docker-entrypoint.sh + +EXPOSE 8620 +VOLUME /hugegraph-server + +ENTRYPOINT ["/usr/bin/dumb-init", "--"] +CMD ["./docker-entrypoint.sh"] diff --git a/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh new file mode 100644 index 0000000000..5aa77621dc --- /dev/null +++ b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/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. +# + +# start hugegraph store +./bin/start-hugegraph-store.sh -j "$JAVA_OPTS" + +tail -f /dev/null