You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2022/08/03 12:31:18 UTC

[iotdb-web-workbench] 23/34: add Docker support for frontend and backend with docker compose

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

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb-web-workbench.git

commit 9c824a38148a99a789fdab663de4d86185b9c1bb
Author: Niklas Merz <ni...@apache.org>
AuthorDate: Tue Sep 21 10:30:59 2021 +0200

    add Docker support for frontend and backend with docker compose
    
    Co-authored-by: Markus Schmidgall <Ma...@googlemail.com>
---
 README.md                                |  3 +++
 backend/Dockerfile                       | 10 ++++++++--
 backend/Dockerfile => docker-compose.yml | 17 ++++++++++++++---
 {backend => frontend}/Dockerfile         | 25 ++++++++++++++++++++++---
 4 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 3a5cfff..6d6c312 100644
--- a/README.md
+++ b/README.md
@@ -25,3 +25,6 @@
 
 This code repo is a web based workbench for [Apache IoTDB](https://iotdb.apache.org)
 
+## Docker
+
+`docker-compose up -d`
\ No newline at end of file
diff --git a/backend/Dockerfile b/backend/Dockerfile
index f6e39cc..10b3078 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -19,6 +19,12 @@
 
 FROM hub.segma.tech/library/java:8-jre-centos7-apollo
 
-COPY target/service-1.0.0.jar /app/app.jar
+WORKDIR /app
 
-ENTRYPOINT ["java", "-jar", "/app/app.jar"]
+COPY . .
+
+RUN mvn package
+
+EXPOSE 8080
+
+ENTRYPOINT ["java", "-jar", "/app/workbench-1.0.0.jar"]
diff --git a/backend/Dockerfile b/docker-compose.yml
similarity index 78%
copy from backend/Dockerfile
copy to docker-compose.yml
index f6e39cc..7100e25 100644
--- a/backend/Dockerfile
+++ b/docker-compose.yml
@@ -17,8 +17,19 @@
 # under the License.
 #
 
-FROM hub.segma.tech/library/java:8-jre-centos7-apollo
+version: "3.8"
 
-COPY target/service-1.0.0.jar /app/app.jar
+services:
+  backend:
+    build: ./backend
+    restart: always
+    ports:
+      - 8081:8080
 
-ENTRYPOINT ["java", "-jar", "/app/app.jar"]
+  frontend:
+    build: ./frontend
+    restart: always
+    ports:
+      - 8080:8080
+    depends_on:
+      - backend
\ No newline at end of file
diff --git a/backend/Dockerfile b/frontend/Dockerfile
similarity index 56%
copy from backend/Dockerfile
copy to frontend/Dockerfile
index f6e39cc..356bc44 100644
--- a/backend/Dockerfile
+++ b/frontend/Dockerfile
@@ -17,8 +17,27 @@
 # under the License.
 #
 
-FROM hub.segma.tech/library/java:8-jre-centos7-apollo
+FROM node:lts-alpine
 
-COPY target/service-1.0.0.jar /app/app.jar
+# From official Vue Documentation https://vuejs.org/v2/cookbook/dockerize-vuejs-app.html
 
-ENTRYPOINT ["java", "-jar", "/app/app.jar"]
+# install simple http server for serving static content
+RUN npm install -g http-server
+
+# make the 'app' folder the current working directory
+WORKDIR /app
+
+# copy both 'package.json' and 'package-lock.json' (if available)
+COPY package*.json ./
+
+# install project dependencies
+RUN npm install
+
+# copy project files and folders to the current working directory (i.e. 'app' folder)
+COPY . .
+
+# build app for production with minification
+RUN npm run build
+
+EXPOSE 8080
+CMD [ "http-server", "dist" ]
\ No newline at end of file