hanisahmk / spring-boot-h2-setup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring Boot Starter

How to use

  1. Fork this project
  2. Add your DDL script here
  3. Add your DML script here
  4. Continue setting up your @Entity classes and @Repository interfaces
  5. You may access the database using the h2-console by visiting the /h2-console path here.

Key Value
Driver Class org.h2.Driver
JDBC URL jdbc:h2:mem:m3db
User Name sa
Password password

Dockerized Commands

Before running the docker commands, make sure you have a .dockerignore file with content target to ignore the artifact folder.

You can still run the Spring Boot Application with docker without any JDK/JRE installed. You should understand what Option A is doing before going for Option B.

cd ./spring-boot-h2-setup/m3project 

# Option A - manual docker command to build and run the project
docker build -t "h2_starter" . 
docker run -d -p 8088:8080 --name "container_h2_starter" h2_starter

# Stop container for rebuild
docker stop container_h2_starter
docker rm container_h2_starter

# Option B (better choice) - use of docker compose
docker compose up 


# Rebuild container
docker compose up --build # add a --build flag to rebuild

Visit http://localhost:8088/test on browser for "Test ok" response to confirm the application is running.

End

About


Languages

Language:Java 92.8%Language:Dockerfile 7.2%