Skip to content
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
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
Dockerfile
docker-compose.yml
**/target
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
FROM maven:3.6-jdk-8-alpine AS builder
WORKDIR /usr/shepher

COPY . .
RUN mvn install

FROM java:8-jdk


Expand All @@ -9,7 +15,10 @@ ENV BASE_DIR /usr/shepher

WORKDIR $SHEPHER_HOME

COPY ./lib/*.jar $SHEPHER_HOME/lib/
COPY ./bin/wait-for-it.sh $SHEPHER_HOME
COPY ./conf/* $SHEPHER_HOME/conf/
CMD ./wait-for-it.sh -t 300 db:3306 && java -jar lib/shepher-web-1.0.jar --spring.config.location=conf/application-base.properties,conf/application-docker.properties -Djava.ext.dirs=lib
COPY --from=builder /usr/shepher/shepher-web/target/*.jar $SHEPHER_HOME/lib/
COPY --from=builder /usr/shepher/shepher-common/target/*.jar $SHEPHER_HOME/lib/
COPY --from=builder /usr/shepher/shepher-model/target/*.jar $SHEPHER_HOME/lib/
COPY --from=builder /usr/shepher/shepher-service/target/*.jar $SHEPHER_HOME/lib/

COPY --from=builder /usr/shepher/conf/* $SHEPHER_HOME/conf/
CMD java -jar lib/shepher-1.0.jar --spring.config.location=conf/application-base.properties,conf/application-docker.properties -Djava.ext.dirs=lib
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ Development environment deployment includes local compilation deployment and Doc
MySQL and ZooKeeper will be automatic integrated when Docker deployment is used, and automatically import `db/init.sql` into MySQL, no self installation is needed.

1. Install Docker, take Ubuntu system for example, install [docker engine](https://docs.docker.com/engine/installation/#installation) and [docker-compose](https://docs.docker.com/compose/install/)
2. Enter install directories
2. Clone repo

```sh
$ cd shepher-packaging/target/shepher-packaging-{version}-bin
$ git clone git@github.com:XiaoMi/shepher.git
$ cd shepher
```
3. Run the script, start Shepher service and waiting start of each container in Docker accomplish
3. Docker compose up to start services

```sh
$ sh bin/docker-run.sh start
$ docker-compose up --build
```
4. Visit `http://localhost:8089` or self defined `server.url` (Reference to [Parameter instruction](Docs/Parameter.md))

Expand Down
122 changes: 0 additions & 122 deletions bin/docker-run.sh

This file was deleted.

161 changes: 0 additions & 161 deletions bin/wait-for-it.sh

This file was deleted.

5 changes: 5 additions & 0 deletions db/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM mysql:5.7.26
COPY init.sql /docker-entrypoint-initdb.d/
COPY --from=healthcheck/mysql /usr/local/bin/docker-healthcheck /usr/local/bin/

HEALTHCHECK CMD ["docker-healthcheck"]
2 changes: 0 additions & 2 deletions db/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


CREATE DATABASE IF NOT EXISTS `shepher`;
USE `shepher`;

--
-- Table structure for table `cluster`
Expand Down
18 changes: 9 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
version: '2'
version: '2.4'
services:
db:
image: mysql
db:
build: ./db
image: shepher-db
environment:
MYSQL_ROOT_PASSWORD: root
volumes:
- ./db:/docker-entrypoint-initdb.d
MYSQL_DATABASE: shepher
web:
build: ./
image: shepher
ports:
- "8089:8089"
depends_on:
- db
- zookeeper
links:
- db
db:
condition: service_healthy
zookeeper:
condition: service_started
zookeeper:
image: zookeeper
expose:
Expand Down