diff --git a/scripts/docker-quick-start/docker-compose.yml b/scripts/docker-quick-start/docker-compose.yml new file mode 100644 index 0000000..ce334de --- /dev/null +++ b/scripts/docker-quick-start/docker-compose.yml @@ -0,0 +1,44 @@ +version: '2' + +services: + sofa-dashboard-quick-start: + image: sofastack/sofa-dashboard-web:1.0.0-SNAPSHOT + container_name: sofa-dashboard-quick-start + depends_on: + - sofa-dashboard-db + - sofa-dashboard-zk + ports: + - "8080:8080" + links: + - sofa-dashboard-zk + - sofa-dashboard-db + + sofa-dashboard-zk: + image: zookeeper:3.4.14 + container_name: sofa-dashboard-zk + environment: + ZOO_MY_ID: 1 + ZOO_SERVERS: server.1=0.0.0.0:2888:3888 + ports: + - "2181:2181" + + sofa-dashboard-db: + image: mysql:5.7 + container_name: sofa-dashboard-db + environment: + TZ: Asia/Shanghai + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + depends_on: + - sofa-dashboard-dbdata + ports: + - "3306:3306" + volumes: + - ../../sql:/docker-entrypoint-initdb.d + volumes_from: + - sofa-dashboard-dbdata + + sofa-dashboard-dbdata: + image: alpine:latest + container_name: sofa-dashboard-dbdata + volumes: + - /var/lib/mysql diff --git a/sofa-dashboard-backend/sofa-dashboard-web/docker/Dockerfile b/sofa-dashboard-backend/sofa-dashboard-web/docker/Dockerfile new file mode 100644 index 0000000..c8301be --- /dev/null +++ b/sofa-dashboard-backend/sofa-dashboard-web/docker/Dockerfile @@ -0,0 +1,10 @@ +FROM openjdk:8 + +WORKDIR /root + +ADD sofa-dashboard-web-latest.jar /root/ + +EXPOSE 8080 + +CMD java -jar sofa-dashboard-web-latest.jar \ + --spring.profiles.active=docker \ No newline at end of file diff --git a/sofa-dashboard-backend/sofa-dashboard-web/docker/build-docker.sh b/sofa-dashboard-backend/sofa-dashboard-web/docker/build-docker.sh new file mode 100644 index 0000000..add1abb --- /dev/null +++ b/sofa-dashboard-backend/sofa-dashboard-web/docker/build-docker.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +echo +echo '--- Build SOFA-Dashboard Docker image ---' +echo " DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" +echo " DOCKER_IMG_NAME=${DOCKER_IMG_NAME}" +echo " SCRIPTS_DIR=${SCRIPTS_DIR}" +echo " ARTIFACT_JAR=${ARTIFACT_JAR}" +echo + +# Re-create build context +rm -rf ${DOCKER_BUILD_DIR} && mkdir -p ${DOCKER_BUILD_DIR} + +# Copy artifact resources +cp -r ${SCRIPTS_DIR}/* ${DOCKER_BUILD_DIR} +cp ${ARTIFACT_JAR} ${DOCKER_BUILD_DIR}/sofa-dashboard-web-latest.jar + + +docker build ${DOCKER_BUILD_DIR} -t ${DOCKER_IMG_NAME} diff --git a/sofa-dashboard-backend/sofa-dashboard-web/pom.xml b/sofa-dashboard-backend/sofa-dashboard-web/pom.xml index 8cad552..c67daef 100644 --- a/sofa-dashboard-backend/sofa-dashboard-web/pom.xml +++ b/sofa-dashboard-backend/sofa-dashboard-web/pom.xml @@ -95,4 +95,64 @@ + + + docker + + + com.alipay.sofa + sofa-dashboard-front + 1.0.0-SNAPSHOT + + + + + + ../../sofa-dashboard-front/target + static + + + src/main/resources + + + + + org.codehaus.mojo + exec-maven-plugin + + + install + + exec + + + bash + + -e + + ${project.basedir}/docker/build-docker.sh + + + + + ${project.build.directory}/docker + + + sofastack/${project.artifactId}:${project.version} + + + ${project.basedir}/docker + + + ${project.build.directory}/${project.artifactId}-${project.version}.jar + + + + + + + + + + \ No newline at end of file diff --git a/sofa-dashboard-backend/sofa-dashboard-web/src/main/resources/application-docker.properties b/sofa-dashboard-backend/sofa-dashboard-web/src/main/resources/application-docker.properties new file mode 100644 index 0000000..75fd8a6 --- /dev/null +++ b/sofa-dashboard-backend/sofa-dashboard-web/src/main/resources/application-docker.properties @@ -0,0 +1,9 @@ +server.port=8080 +# ark 管控端配置中心地址 +com.alipay.sofa.dashboard.zookeeper.address=sofa-dashboard-zk:2181 +# mysql 数据库连接属性配置 +spring.datasource.url=jdbc:mysql://sofa-dashboard-db:3306/SofaDashboardDB +spring.datasource.username=root +spring.datasource.password= +# zookeeper 注册中心地址 +com.alipay.sofa.dashboard.registry=zookeeper://sofa-dashboard-zk:2181 diff --git a/sofa-dashboard-front/config/config.js b/sofa-dashboard-front/config/config.js index 0a6cb44..65cf7f1 100644 --- a/sofa-dashboard-front/config/config.js +++ b/sofa-dashboard-front/config/config.js @@ -71,7 +71,7 @@ export default { }, // build path - outputPath: '/home/admin/release/run/target/static', + outputPath: 'target', proxy: { '/api': { diff --git a/sofa-dashboard-front/pom.xml b/sofa-dashboard-front/pom.xml index 1127fda..3d22a68 100644 --- a/sofa-dashboard-front/pom.xml +++ b/sofa-dashboard-front/pom.xml @@ -11,5 +11,47 @@ sofa-dashboard-front + + + docker + + + + org.codehaus.mojo + exec-maven-plugin + + + npm-install + validate + + exec + + + npm + + install + + + + + npm-run-build + generate-resources + + exec + + + npm + + run + build + + + + + + + + + \ No newline at end of file