This is a simple Spring Boot application called containerize with 3 GET endpoints that return JSON responses.
The application can be easily packaged into a Docker container.
The application has three endpoints:
- /greeting - Returns a greeting message. You can pass a name as a query parameter to customize the greeting.
- /user - Returns a list of usernames.
- /userid - Returns a list of user IDs.
Make sure you have the following installed:
- Java 17 or higher
- Maven 3.8.1 or higher
- Docker (if you want to containerize the app)
- Clone the repository:
git clone https://github.com/tauseef-ameen/containerize.git
- Navigate to the project directory:
cd containerize - Build the project:
mvn clean install
Start the application:
mvn spring-boot:run- URL:
/greeting - Example:
- Default:
curl http://localhost:8080/greeting
- Custom:
curl http://localhost:8080/greeting?name=User
- Default:
- URL:
/user - Example:
curl http://localhost:8080/user
- URL:
/userid - Example:
curl http://localhost:8080/userid
To create a Docker image, simply run:
mvn clean install -PcreateimageOnce the image is built, you can run it with:
docker run -p 8080:8080 medium/docker-containerize:1.0.0-SNAPSHOTFeel free to fork this repository and submit a pull request if you have any improvements or fixes!