8000 GitHub - Leward/docker-boot: Demo project for Spring Boot and Docker using tomcat as a base image
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Leward/docker-boot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This application shows how to deploy a Spring Boot application with Docker (17.06.0+) using:

  • Tomcat as a base image
  • Docker Swarm
  • Configuration

Note on Oracle

This app uses Spring Data JPA. To use it with Oracle, a JDBC driver is needed but available in the Maven Central. There two ways of addressing the issue:

  1. Put the ojdbc.jar in the project folder and copy it in the tomcat lib/ folder
  2. Put the ojdbc.jar in the enterprise maven repo and add it as a dependency.

Build and Run

Build

mvn clean package
docker build . -t leward/docker-boot 

Run

docker run --rm -p 8080:8080 --name=docker-boot leward/docker-boot

Run with custom configuration

As a regular container

With environment variables

docker run --rm \
    -p 8080:8080 \
    -e app_world=monde \
    --name=docker-boot \
    leward/docker-boot

With an application.properties file

echo "app.hello=bonjour" > application.properties
docker run --rm \
    -p 8080:8080 \
    -v $(pwd)/application.properties:/usr/local/tomcat/application.properties \
    --name=docker-boot \
    leward/docker-boot

With docker swarm

(Use docker swarm init to enable swarm mode)

Read:

Config vs Secrets

docker stack deploy -c config/dev/docker-compose.yml docker-boot

Verify the config has been loaded:

$ curl -s http://localhost:8080/hello
{"cwd":"/usr/local/tomcat","world":"dev","greeting":"bonjour dev!","hello":"bonjour"}

About

Demo project for Spring Boot and Docker using tomcat as a base image

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0