diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..19d49af --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git/ +*.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8f68a34..1365b24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,14 @@ -FROM openjdk:8-jre-alpine +FROM maven:3.8.6-openjdk-8 as builder +COPY . . +RUN mvn clean package -DskipTests -Dgpg.skip +FROM openjdk:8-jre-alpine ENV MY_HOME=/app - ARG JAVA_OPTS="" - ENV OPTS=$JAVA_OPTS +COPY --from=builder brcc-server/target/*.jar $MY_HOME/app.jar WORKDIR $MY_HOME - EXPOSE 8088 - RUN apk add --update ttf-dejavu fontconfig - -ADD brcc-server/target/*.jar $MY_HOME/app.jar - ENTRYPOINT ["sh","-c","java $OPTS -Djava.security.egd=file:/dev/urandom -jar app.jar"] diff --git a/Dockerfile-mysql b/Dockerfile-mysql new file mode 100644 index 0000000..9e0519f --- /dev/null +++ b/Dockerfile-mysql @@ -0,0 +1,9 @@ +FROM mysql:5.7 +ENV MYSQL_DATABASE brcc +ENV MYSQL_ROOT_PASSWORD brcc123456 + +COPY doc/database/*.sql /docker-entrypoint-initdb.d/ + +RUN chmod 777 /docker-entrypoint-initdb.d -R + +CMD [ "mysqld", "--sql-mode=", "--max_allowed_packet=1024M", "--character-set-server=utf8mb4" ] diff --git a/brcc-core/src/main/java/com/baidu/brcc/service/impl/ConfigGroupServiceImpl.java b/brcc-core/src/main/java/com/baidu/brcc/service/impl/ConfigGroupServiceImpl.java index 332ae19..5e06f2f 100644 --- a/brcc-core/src/main/java/com/baidu/brcc/service/impl/ConfigGroupServiceImpl.java +++ b/brcc-core/src/main/java/com/baidu/brcc/service/impl/ConfigGroupServiceImpl.java @@ -18,7 +18,6 @@ */ package com.baidu.brcc.service.impl; -import java.security.acl.Group; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; diff --git a/doc/database/schema.sql b/doc/database/1.schema.sql similarity index 87% rename from doc/database/schema.sql rename to doc/database/1.schema.sql index 0119de5..b065a98 100644 --- a/doc/database/schema.sql +++ b/doc/database/1.schema.sql @@ -1,5 +1,5 @@ drop database if exists brcc; -drop user 'brcc'@'%'; +drop user if exists 'brcc'@'%'; create database brcc default character set utf8mb4 collate utf8mb4_unicode_ci; use brcc; create user 'brcc'@'%' identified by 'brcc123456'; diff --git a/doc/database/tables.sql b/doc/database/2.tables.sql similarity index 100% rename from doc/database/tables.sql rename to doc/database/2.tables.sql diff --git a/doc/database/data.sql b/doc/database/3.data.sql similarity index 100% rename from doc/database/data.sql rename to doc/database/3.data.sql diff --git a/doc/deploy-guide.md b/doc/deploy-guide.md index 2242144..431b115 100644 --- a/doc/deploy-guide.md +++ b/doc/deploy-guide.md @@ -91,4 +91,14 @@ http://ip:port 其中IP为服务启动的IP,Port为web服务监听端口,例 # 三、 容器化部署 - [制作Docker镜像](./docker-guide.md) -- [Kubernetes](./k8s-guide.md) \ No newline at end of file +- [Kubernetes](./k8s-guide.md) + +## Docker-compose 快速部署 + + + 在工程根目录执行: `docker-compose up -d` + +> 这里使用的 docker-compose 3 + +浏览器访问WebUI: http://localhost:8088 + \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9ade105 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,37 @@ +version: "3.9" + +services: + mysql: + platform: linux/amd64 + build: + context: . + dockerfile: Dockerfile-mysql + + redis: + image: redis:5.0 + + server: + build: + context: . + dockerfile: Dockerfile + environment: + - SERVER_PORT=8088 + - REDIS_HOST=redis + - REDIS_PORT=6379 + - DB_HOST=mysql + - DB_PORT=3306 + - DB_USERNAME=brcc + - DB_PASSWORD=brcc123456 + ports: + - "8088:8088" + links: + - mysql + - redis + depends_on: + - mysql + - redis + + + + +