Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
springboot-maven3-centos
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
luiz.nunes
springboot-maven3-centos
Commits
55eafc07
Commit
55eafc07
authored
Mar 01, 2016
by
Benedikt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use s2i best practices adopted from openshift/sti-base and openshift/sti-ruby
parent
06bdfd92
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
26 deletions
+31
-26
Dockerfile
Dockerfile
+10
-7
README.md
README.md
+5
-12
assemble
s2i/bin/assemble
+0
-0
run
s2i/bin/run
+0
-0
save-artifacts
s2i/bin/save-artifacts
+0
-0
usage
s2i/bin/usage
+0
-0
run
test/run
+16
-7
No files found.
Dockerfile
View file @
55eafc07
...
@@ -5,6 +5,13 @@
...
@@ -5,6 +5,13 @@
FROM
centos:centos7
FROM
centos:centos7
# Location of the STI scripts inside the image
#
LABEL
io.openshift.s2i.scripts-url=image:///usr/libexec/s2i
# Path to be used in other layers to place s2i scripts into
ENV
STI_SCRIPTS_PATH=/usr/libexec/s2i
ENV
JAVA_VERSON 1.8.0
ENV
JAVA_VERSON 1.8.0
ENV
MAVEN_VERSION 3.3.9
ENV
MAVEN_VERSION 3.3.9
...
@@ -21,12 +28,7 @@ ENV JAVA_HOME /usr/lib/jvm/java
...
@@ -21,12 +28,7 @@ ENV JAVA_HOME /usr/lib/jvm/java
ENV
MAVEN_HOME /usr/share/maven
ENV
MAVEN_HOME /usr/share/maven
# Add configuration files, bashrc and other tweaks
# Add configuration files, bashrc and other tweaks
ADD
./.sti/bin/usage /opt/java/bin/
ADD
./s2i/bin/ $STI_SCRIPTS_PATH
# Default STI scripts url
ENV
STI_SCRIPTS_URL https://raw.githubusercontent.com/codecentric/springboot-maven3-centos/master/.sti/bin
# Default destination of scripts and sources, this is where assemble will look for them
ENV
STI_LOCATION /tmp
# Create 'ruby' account we will use to run Ruby application
# Create 'ruby' account we will use to run Ruby application
# Add support for '#!/usr/bin/ruby' shebang.
# Add support for '#!/usr/bin/ruby' shebang.
...
@@ -51,4 +53,5 @@ USER java
...
@@ -51,4 +53,5 @@ USER java
EXPOSE
8080
EXPOSE
8080
CMD
["/opt/java/bin/usage"]
# Set the default CMD to print the usage of the language image
CMD
$STI_SCRIPTS_PATH/usage
README.md
View file @
55eafc07
...
@@ -5,7 +5,7 @@ This repository contains the sources and
...
@@ -5,7 +5,7 @@ This repository contains the sources and
[
Dockerfile
](
https://github.com/codecentric/springboot-maven3-centos/blob/master/Dockerfile
)
[
Dockerfile
](
https://github.com/codecentric/springboot-maven3-centos/blob/master/Dockerfile
)
of the base image for deploying Spring Boot applications as reproducible Docker
of the base image for deploying Spring Boot applications as reproducible Docker
images. The resulting images can be run either by
[
Docker
](
http://docker.io
)
images. The resulting images can be run either by
[
Docker
](
http://docker.io
)
or using
[
S
T
I
](
https://github.com/openshift/source-to-image
)
.
or using
[
S
2
I
](
https://github.com/openshift/source-to-image
)
.
This image is heavily inspired by the awesome
[
openshift/ruby-20-centos
](
https://github.com/openshift/ruby-20-centos/
)
This image is heavily inspired by the awesome
[
openshift/ruby-20-centos
](
https://github.com/openshift/ruby-20-centos/
)
builder image.
builder image.
...
@@ -18,9 +18,9 @@ _TODO_ Publish Image to Docker Hub
...
@@ -18,9 +18,9 @@ _TODO_ Publish Image to Docker Hub
Repository organization
Repository organization
------------------------
------------------------
*
**`
.st
i/bin/`**
*
**`
s2
i/bin/`**
This folder contains scripts that are run by
[
S
T
I
](
https://github.com/openshift/source-to-image
)
:
This folder contains scripts that are run by
[
S
2
I
](
https://github.com/openshift/source-to-image
)
:
*
**assemble**
*
**assemble**
...
@@ -51,13 +51,6 @@ Environment variables
...
@@ -51,13 +51,6 @@ Environment variables
application GIT repository. In case your application is located in a
application GIT repository. In case your application is located in a
sub-folder, you can set this variable to a *./myapplication*.
sub-folder, you can set this variable to a *./myapplication*.
*
**STI_SCRIPTS_URL**
(default: '
[
.sti/bin
](
https://raw.githubusercontent.com/codecentric/springboot-maven3-centos/master/.sti/bin
)
')
This variable specifies the location of directory, where *assemble*, *run* and
*save-artifacts* scripts are downloaded/copied from. By default the scripts
in this repository will be used, but users can provide an alternative
location and run their own scripts.
Contributing
Contributing
------------
------------
...
@@ -76,10 +69,10 @@ Usage
...
@@ -76,10 +69,10 @@ Usage
**Building the [spring-boot-example](https://github.com/codecentric/spring-boot-example) Spring Boot application..**
**Building the [spring-boot-example](https://github.com/codecentric/spring-boot-example) Spring Boot application..**
1.
**using standalone [S
T
I](https://github.com/openshift/source-to-image) and running the resulting image by [Docker](http://docker.io):**
1.
**using standalone [S
2
I](https://github.com/openshift/source-to-image) and running the resulting image by [Docker](http://docker.io):**
```
```
$ s
t
i build git://github.com/codecentric/spring-boot-example codecentric/springboot-maven3-centos spring-boot-app
$ s
2
i build git://github.com/codecentric/spring-boot-example codecentric/springboot-maven3-centos spring-boot-app
$ docker run -p 8080:8080 spring-boot-app
$ docker run -p 8080:8080 spring-boot-app
```
```
...
...
.st
i/bin/assemble
→
s2
i/bin/assemble
View file @
55eafc07
File moved
.st
i/bin/run
→
s2
i/bin/run
View file @
55eafc07
File moved
.st
i/bin/save-artifacts
→
s2
i/bin/save-artifacts
View file @
55eafc07
File moved
.st
i/bin/usage
→
s2
i/bin/usage
View file @
55eafc07
File moved
test/run
View file @
55eafc07
...
@@ -13,9 +13,9 @@ image_dir=$(readlink -zf ${test_dir}/..)
...
@@ -13,9 +13,9 @@ image_dir=$(readlink -zf ${test_dir}/..)
scripts_url
=
"file://
${
image_dir
}
/.sti/bin"
scripts_url
=
"file://
${
image_dir
}
/.sti/bin"
cid_file
=
$(
mktemp
-u
--suffix
=
.cid
)
cid_file
=
$(
mktemp
-u
--suffix
=
.cid
)
# Since we built the candidate image locally, we don't want S
T
I attempt to pull
# Since we built the candidate image locally, we don't want S
2
I attempt to pull
# it from Docker hub
# it from Docker hub
s
ti_args
=
"-s
${
scripts_url
}
"
s
2i_args
=
"--force-pull=false
"
# TODO: This should be part of the image metadata
# TODO: This should be part of the image metadata
test_port
=
8080
test_port
=
8080
...
@@ -36,8 +36,8 @@ container_ip() {
...
@@ -36,8 +36,8 @@ container_ip() {
docker inspect
--format
=
"{{ .NetworkSettings.IPAddress }}"
$(
cat
$cid_file
)
docker inspect
--format
=
"{{ .NetworkSettings.IPAddress }}"
$(
cat
$cid_file
)
}
}
run_s
t
i_build
()
{
run_s
2
i_build
()
{
s
t
i build
${
sti_args
}
file://
${
test_dir
}
/test-app
${
IMAGE_NAME
}
${
IMAGE_NAME
}
-testapp
s
2
i build
${
sti_args
}
file://
${
test_dir
}
/test-app
${
IMAGE_NAME
}
${
IMAGE_NAME
}
-testapp
}
}
prepare
()
{
prepare
()
{
...
@@ -95,9 +95,14 @@ wait_for_cid() {
...
@@ -95,9 +95,14 @@ wait_for_cid() {
done
done
}
}
test_usage
()
{
test_
s2i_
usage
()
{
info
"Testing the 'sti usage' command"
info
"Testing the 'sti usage' command"
sti usage
${
sti_args
}
${
IMAGE_NAME
}
&>/dev/null
s2i usage
${
sti_args
}
${
IMAGE_NAME
}
&>/dev/null
}
test_docker_run_usage
()
{
info
"Testing 'docker run' usage"
docker run
${
IMAGE_NAME
}
&>/dev/null
}
}
test_connection
()
{
test_connection
()
{
...
@@ -130,7 +135,11 @@ run_sti_build
...
@@ -130,7 +135,11 @@ run_sti_build
check_result
$?
check_result
$?
# Verify the 'usage' script is working properly
# Verify the 'usage' script is working properly
test_usage
test_s2i_usage
check_result
$?
# Verify the 'usage' script is working properly when running the base image with 'docker run ...'
test_docker_run_usage
check_result
$?
check_result
$?
# Verify that the HTTP connection can be established to test application container
# Verify that the HTTP connection can be established to test application container
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment