Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add quick setup with docker-compose #188

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git/
*.md
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
9 changes: 9 additions & 0 deletions Dockerfile-mysql
Original file line number Diff line number Diff line change
@@ -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" ]
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion doc/database/schema.sql → doc/database/1.schema.sql
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 11 additions & 1 deletion doc/deploy-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,14 @@ http://ip:port 其中IP为服务启动的IP,Port为web服务监听端口,例
# 三、 容器化部署
- [制作Docker镜像](./docker-guide.md)

- [Kubernetes](./k8s-guide.md)
- [Kubernetes](./k8s-guide.md)

## Docker-compose 快速部署


在工程根目录执行: `docker-compose up -d`

> 这里使用的 docker-compose 3

浏览器访问WebUI: http://localhost:8088

37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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