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

ranke pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git


The following commit(s) were added to refs/heads/develop by this push:
     new 2875904  polish dockerfile for 0.3.0 (#805)
2875904 is described below

commit 28759040e568b5c07fa6a4e469fc110fd1350220
Author: Huang YunKun <[email protected]>
AuthorDate: Fri Aug 27 08:51:04 2021 +0800

    polish dockerfile for 0.3.0 (#805)
    
    * update dockerfile and enable autotest
    
    * fix test script
    
    * fix zookeeper version
    
    * fix rat
---
 README.md                                          |  2 +-
 README_ZH.md                                       |  2 +-
 docker/0.3.0/Dockerfile                            | 11 ++++---
 docker/0.3.0/{Dockerfile => Dockerfile.test}       | 18 ++++--------
 .../0.3.0/{Dockerfile => docker-compose.test.yml}  | 34 ++++++++++++----------
 docker/0.3.0/{Dockerfile => test.sh}               | 33 +++++++++++----------
 6 files changed, 48 insertions(+), 52 deletions(-)

diff --git a/README.md b/README.md
index 37be75b..e018245 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
 ### Quick start
 
 * prebuilt docker image https://hub.docker.com/r/apache/dubbo-admin
-* quick start a live demo with 
[play-with-docker](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/apache/dubbo-admin/develop/docker/stack.yml#)
 (version:0.1.0)
+* quick start a live demo with 
[play-with-docker](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/apache/dubbo-admin/develop/docker/stack.yml#)
 (version:0.3.0)
 
 ### Screenshot
 
diff --git a/README_ZH.md b/README_ZH.md
index f4f0d90..c1a21d1 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -8,7 +8,7 @@
 ### 快速开始
 
 * 预构建的Docker镜像 https://hub.docker.com/r/apache/dubbo-admin
-* 快速启动一个演示环境 
[play-with-docker](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/apache/dubbo-admin/develop/docker/stack.yml#)
 (版本:0.1.0)
+* 快速启动一个演示环境 
[play-with-docker](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/apache/dubbo-admin/develop/docker/stack.yml#)
 (版本:0.3.0)
 
 ### 页面截图
 
diff --git a/docker/0.3.0/Dockerfile b/docker/0.3.0/Dockerfile
index 5432d3d..ac31116 100644
--- a/docker/0.3.0/Dockerfile
+++ b/docker/0.3.0/Dockerfile
@@ -14,16 +14,15 @@
 # limitations under the License.
 
 FROM maven:3-openjdk-8
-RUN mkdir -p /source/dubbo-admin-snapshot
-ADD . /source/dubbo-admin-snapshot
-WORKDIR /source/dubbo-admin-snapshot
-RUN mvn --batch-mode -Prelease clean package -Dmaven.test.skip=true
+RUN mkdir /source && wget 
https://github.com/apache/dubbo-admin/archive/0.3.0.zip && unzip -q 0.3.0.zip 
-d /source
+WORKDIR /source/dubbo-admin-0.3.0
+RUN mvn --batch-mode clean package -Dmaven.test.skip=true
 
 FROM openjdk:8-jre
 LABEL maintainer="[email protected]"
 RUN apt-get update && apt-get install -y tini
-COPY --from=0 
/source/dubbo-admin-snapshot/dubbo-admin-distribution/target/dubbo-admin-0.3.0.jar
 /app.jar
-COPY --from=0 /source/dubbo-admin-snapshot/docker/entrypoint.sh 
/usr/local/bin/entrypoint.sh
+COPY --from=0 
/source/dubbo-admin-0.3.0/dubbo-admin-distribution/target/dubbo-admin-0.3.0.jar 
/app.jar
+COPY --from=0 /source/dubbo-admin-0.3.0/docker/entrypoint.sh 
/usr/local/bin/entrypoint.sh
 
 ENV JAVA_OPTS ""
 
diff --git a/docker/0.3.0/Dockerfile b/docker/0.3.0/Dockerfile.test
similarity index 56%
copy from docker/0.3.0/Dockerfile
copy to docker/0.3.0/Dockerfile.test
index 5432d3d..dee4d1d 100644
--- a/docker/0.3.0/Dockerfile
+++ b/docker/0.3.0/Dockerfile.test
@@ -13,19 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM maven:3-openjdk-8
-RUN mkdir -p /source/dubbo-admin-snapshot
-ADD . /source/dubbo-admin-snapshot
-WORKDIR /source/dubbo-admin-snapshot
-RUN mvn --batch-mode -Prelease clean package -Dmaven.test.skip=true
+FROM ubuntu:trusty
+RUN apt-get update && apt-get install -yq curl && apt-get clean
 
-FROM openjdk:8-jre
-LABEL maintainer="[email protected]"
-RUN apt-get update && apt-get install -y tini
-COPY --from=0 
/source/dubbo-admin-snapshot/dubbo-admin-distribution/target/dubbo-admin-0.3.0.jar
 /app.jar
-COPY --from=0 /source/dubbo-admin-snapshot/docker/entrypoint.sh 
/usr/local/bin/entrypoint.sh
+WORKDIR /app
 
-ENV JAVA_OPTS ""
+ADD test.sh /app/test.sh
 
-ENTRYPOINT ["tini", "--", "/usr/local/bin/entrypoint.sh"]
-EXPOSE 8080
+CMD ["bash", "test.sh"]
\ No newline at end of file
diff --git a/docker/0.3.0/Dockerfile b/docker/0.3.0/docker-compose.test.yml
similarity index 56%
copy from docker/0.3.0/Dockerfile
copy to docker/0.3.0/docker-compose.test.yml
index 5432d3d..9ac7fec 100644
--- a/docker/0.3.0/Dockerfile
+++ b/docker/0.3.0/docker-compose.test.yml
@@ -13,19 +13,21 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM maven:3-openjdk-8
-RUN mkdir -p /source/dubbo-admin-snapshot
-ADD . /source/dubbo-admin-snapshot
-WORKDIR /source/dubbo-admin-snapshot
-RUN mvn --batch-mode -Prelease clean package -Dmaven.test.skip=true
-
-FROM openjdk:8-jre
-LABEL maintainer="[email protected]"
-RUN apt-get update && apt-get install -y tini
-COPY --from=0 
/source/dubbo-admin-snapshot/dubbo-admin-distribution/target/dubbo-admin-0.3.0.jar
 /app.jar
-COPY --from=0 /source/dubbo-admin-snapshot/docker/entrypoint.sh 
/usr/local/bin/entrypoint.sh
-
-ENV JAVA_OPTS ""
-
-ENTRYPOINT ["tini", "--", "/usr/local/bin/entrypoint.sh"]
-EXPOSE 8080
+zookeeper:
+  image: zookeeper:3.5
+admin:
+  build: .
+  dockerfile: Dockerfile
+  links:
+    - zookeeper
+  environment:
+    - admin.registry.address=zookeeper://zookeeper:2181
+    - admin.config-center=zookeeper://zookeeper:2181
+    - admin.metadata-report.address=zookeeper://zookeeper:2181
+  ports: 
+    - 8080
+sut:
+  build: .
+  dockerfile: Dockerfile.test
+  links:
+    - admin
\ No newline at end of file
diff --git a/docker/0.3.0/Dockerfile b/docker/0.3.0/test.sh
old mode 100644
new mode 100755
similarity index 56%
copy from docker/0.3.0/Dockerfile
copy to docker/0.3.0/test.sh
index 5432d3d..d342e35
--- a/docker/0.3.0/Dockerfile
+++ b/docker/0.3.0/test.sh
@@ -4,28 +4,31 @@
 # 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.
 
-FROM maven:3-openjdk-8
-RUN mkdir -p /source/dubbo-admin-snapshot
-ADD . /source/dubbo-admin-snapshot
-WORKDIR /source/dubbo-admin-snapshot
-RUN mvn --batch-mode -Prelease clean package -Dmaven.test.skip=true
+LOOP_SIZE=60
+i=0
 
-FROM openjdk:8-jre
-LABEL maintainer="[email protected]"
-RUN apt-get update && apt-get install -y tini
-COPY --from=0 
/source/dubbo-admin-snapshot/dubbo-admin-distribution/target/dubbo-admin-0.3.0.jar
 /app.jar
-COPY --from=0 /source/dubbo-admin-snapshot/docker/entrypoint.sh 
/usr/local/bin/entrypoint.sh
+while [[ $i -lt LOOP_SIZE ]]; do
+       status_code=$(curl --write-out %{http_code} --silent --output /dev/null 
http://admin:8080)
 
-ENV JAVA_OPTS ""
+  if [[ "$status_code" -eq 200 ]] ; then
+    echo "Tests passed!"
+    exit 0
+  else
+    curl -v http://admin:8080
+    echo "status is incorrect, waiting for next turn"
+  fi
+       sleep 5
+       i=$i+1
+done
 
-ENTRYPOINT ["tini", "--", "/usr/local/bin/entrypoint.sh"]
-EXPOSE 8080
+echo "Tests failed!"
+exit 1
\ No newline at end of file

Reply via email to