Install Java 1.8, Maven, git, docker.
Using git: git clone https://github.com/gfengster/cake-manager.git
Download zip: https://github.com/gfengster/cake-manager/archive/main.zip
- Test, build and pack the project
In a terminal, change path to the project.
mvn clean test package
- Run the application
java -jar ./target/cake-manager.jar
- Test, build and pack the project
In a terminal, change path to the project.
mvn clean test package
- Build docker image
docker build --tag cake-manager:latest .
- Run a container
docker run -p 8080:8080 -p 18080:18080 cake-manager
The project source code is hosted in GitHub. CI/CD has been configured in workflows.
Changing code could trigger CI workflow, which test, build the project. If succeeded, docker image will be created and deployed to DockerHub.
CI/CD could be triggered manually.
- The auto built docker image location
https://hub.docker.com/repository/docker/gfengster/cake-manager - Pull docker image built in GitHub from DockerHub
docker pull gfengster/cake-manager:latest
- Create a container and run the application
docker run -p 8080:8080 -p 18080:18080 gfengster/cake-manager
Note: Before run the application make sure port 8080, 18080 are free.
- List all cakes in table with browser
http://localhost:8080 - Retrieve all cakes in JSON format
http://localhost:8080/cakes - Retrieve a cake with id in JSON format
http://localhost:8080/cakes/{id}
For example
http://localhost:8080/cakes/2 - Create a cake with browser
http://www.localhost:8080/create.html - Create a cake with curl in terminal
echo '{"title":"GFeng cake","desc":"My favourite cake is self made","image":"https://content.sponge.co.uk/sponge-heroes/_conceptHeroWide1x/Vegan-main-concpets2.jpg"}' | curl -X POST -d @- http://localhost:8080/cakes --header "Content-Type:application/json"
- Check the created cake in browser
http://localhost:8080 - Cakes list can be viewed from database directly in browser if the application run in local machine
[http://localhost:8080/h2[(http://localhost:8080/h2) - View SpringBoot actuator, which shows application internal information.
http://localhost:18080/actuator/
http://localhost:18080/actuator/health
http://localhost:18080/actuator/info