Skip to content

Commit 1d0517a

Browse files
committed
Initial commit
0 parents  commit 1d0517a

20 files changed

+815
-0
lines changed

.gitignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
4+
### STS ###
5+
.apt_generated
6+
.classpath
7+
.factorypath
8+
.project
9+
.settings
10+
.springBeans
11+
.sts4-cache
12+
13+
### IntelliJ IDEA ###
14+
.idea
15+
*.iws
16+
*.iml
17+
*.ipr
18+
19+
### NetBeans ###
20+
/nbproject/private/
21+
/build/
22+
/nbbuild/
23+
/dist/
24+
/nbdist/
25+
/.nb-gradle/

.mvn/wrapper/maven-wrapper.jar

46.5 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip

Dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM java:8-jre-alpine
2+
3+
MAINTAINER Sylwester Sokolowski <[email protected]>
4+
5+
RUN apk add --no-cache curl
6+
7+
COPY target/spring-boot-admin-docker-*.jar /opt/spring-boot-admin-docker/app.jar
8+
9+
COPY application-docker.properties /opt/spring-boot-admin-docker/application-docker.properties
10+
11+
EXPOSE 1111
12+
13+
WORKDIR /opt/spring-boot-admin-docker
14+
15+
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=docker","-jar","app.jar"]
16+

README.md

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Spring Boot Admin Docker
2+
===========================================
3+
Yet another implementation containerized of the [spring-boot-admin](https://github.com/codecentric/spring-boot-admin)
4+
5+
Info
6+
----
7+
- Name: `slydeveloper/spring-boot-admin`
8+
- Version: `latest`,`1.0`
9+
- [Docker Hub](https://hub.docker.com/u/slydeveloper/)
10+
11+
Details
12+
--------
13+
- Image based on `java:8-jre-alpine`
14+
- Spring Boot Admin version: `2.0.1`
15+
- Default port: `1111`
16+
- Default user: `admin`
17+
- Default password: `secret`
18+
- Health check - `http://localhost:1111/health`
19+
20+
Usage
21+
--------
22+
`docker run -d -p 1111:1111 --name spring-boot-admin slydeveloper/spring-boot-admin:latest`
23+
24+
Configuration via environment variables
25+
---------------------------------------
26+
* `SPRING_BOOT_ADMIN_USER_NAME=user`
27+
* set username: `user`
28+
* `SPRING_BOOT_ADMIN_USER_PASSWORD=password`
29+
* set password: `password`
30+
* `SPRING_BOOT_ADMIN_TITLE=test`
31+
* set Page-Title: `test`
32+
* `SPRING_BOOT_ADMIN_SECURITY_ENABLED=false`
33+
* disable default : `password`
34+
35+
##### Examples
36+
* `docker run -d -p 1111:1111 -e SPRING_BOOT_ADMIN_TITLE='SB Admin' -e SPRING_BOOT_ADMIN_SECURITY_ENABLED=false --name spring-boot-admin slydeveloper/spring-boot-admin:latest`
37+
* `docker run -d -p 1111:1111 -e SPRING_BOOT_ADMIN_USER_NAME=user -e SPRING_BOOT_ADMIN_USER_PASSWORD='password' --name spring-boot-admin slydeveloper/spring-boot-admin:latest`
38+
39+
Configuration via properties file
40+
---------------------------------
41+
A container supports configuration via *.properties file, just like regular Spring Boot application.
42+
Please note that environment variables will be override by properties file.
43+
Properties of Spring Boot Admin: http://codecentric.github.io/spring-boot-admin/2.0.1/#spring-boot-admin-server
44+
45+
Example `application-docker.properties` file:
46+
```
47+
# Spring Boot server port
48+
server.port=2222
49+
50+
# Spring Boot Admin user/uassword
51+
spring.security.user.name=user
52+
spring.security.user.password=password
53+
54+
# Spring Boot Admin title
55+
spring.boot.admin.ui.title=Custom title
56+
57+
# custom property for disable security
58+
spring.boot.admin.security.enabled=false
59+
```
60+
61+
Example command:
62+
- `docker run -d -p 2222:2222 -v "$(pwd)"/application-docker.properties:/opt/spring-boot-admin-docker/application-docker.properties --name spring-boot-admin slydeveloper/spring-boot-admin:latest`
63+
64+
Docker-Compose example
65+
----------------------
66+
Health check usage of `slydeveloper/spring-boot-admin` with Docker-Compose.
67+
Full working Spring Boot Admin client [here](https://github.com/slydeveloper).
68+
```
69+
version: '2.1'
70+
71+
services:
72+
example:
73+
image: <SOME_SPRING_BOOT_ADMIN_CLIENT_IMAGE>
74+
ports:
75+
- 8080:8080
76+
depends_on:
77+
admin:
78+
condition: service_healthy
79+
container_name: spring_boot_admin_example
80+
admin:
81+
image: slydeveloper/spring-boot-admin
82+
environment:
83+
- SPRING_BOOT_ADMIN_TITLE=Custom Spring Boot Admin title
84+
volumes:
85+
- ./application-docker.properties:/opt/spring-boot-admin-docker/application-docker.properties
86+
ports:
87+
- 1111:1111
88+
healthcheck:
89+
test: "curl -sS http://localhost:1111/health"
90+
interval: 1s
91+
timeout: 60s
92+
retries: 120
93+
container_name: spring_boot_admin_docker
94+
```
95+
96+
Links
97+
-----
98+
- Spring Boot Admin documentation: http://codecentric.github.io/spring-boot-admin/2.0.1/

application-docker.properties

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Spring Boot server port
2+
# server.port=2222
3+
4+
# Spring Boot Admin user/uassword
5+
# spring.security.user.name=user
6+
# spring.security.user.password=password
7+
8+
# Spring Boot Admin title
9+
# spring.boot.admin.ui.title=Custom title
10+
11+
# custom property for disable security
12+
# spring.boot.admin.security.enabled=false

docker-container-run.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# stop running container
4+
docker stop spring-boot-admin
5+
6+
# remove old container
7+
docker rm spring-boot-admin
8+
9+
# run container
10+
docker run -d -p 1111:1111 --name spring-boot-admin slydeveloper/spring-boot-admin:latest

docker-image-build.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
USERNAME=slydeveloper
6+
IMAGE=spring-boot-admin
7+
8+
# build JAR package
9+
mvn clean package -Dmaven.test.skip=true
10+
11+
# build Docker image
12+
docker build -t $USERNAME/$IMAGE:latest .

docker-image-publish.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
USERNAME=slydeveloper
6+
IMAGE=spring-boot-admin
7+
VERSION=1.0
8+
9+
# build JAR package
10+
mvn clean package -Dmaven.test.skip=true
11+
12+
# build Docker image
13+
docker build -t $USERNAME/$IMAGE:latest .
14+
15+
# tag image
16+
docker tag $USERNAME/$IMAGE:latest $USERNAME/$IMAGE:$VERSION
17+
18+
# push images
19+
docker push $USERNAME/$IMAGE:latest
20+
docker push $USERNAME/$IMAGE:$VERSION
21+

0 commit comments

Comments
 (0)