This is a simple REST API built with Spring Boot (Spring Web) and containerized with Docker
- Clone repo: gh repo clone duc-lq/todo-api
- Build Docker image: docker build -t todo-api .
- Run container: docker run -p 8080:8080 todo-api
- Test (use Postman with the collection in src/main/resources/):
- GET - http://localhost:8080/todos
- POST - http://localhost:8080/todos with body {"task":"Clone repo"}
- POST - http://localhost:8080/todos with body {"task":"Build docker image"}
- POST - http://localhost:8080/todos with body {"task":"Run container"}
- POST - http://localhost:8080/todos with body {"task":"Test API"}
- DELETE - http://localhost:8080/todos/{id} - for example: http://localhost:8080/todos/3
- Pull the image: docker pull duclq/todo-api:latest
- Run container: docker run -p 8080:8080 duclq/todo-api:latest
- Test (same as above)
This project is set up with automated CI/CD pipelines to build and deploy the Docker image to Docker Hub. Two methods are implemented:
- Tool: GitHub Actions
- Config: Check ".github/workflows/ci-cd.yml" in source folder for more information
- Steps:
- Builds with Java 17
- Packages the app
- Push to Docker Hub
- Tool: Jenkins (pipeline runs on Windows)
- Config: Check "Jenkins" file
- Steps:
- Checks out code from 'main' branch
- Builds with Maven and Java 17
- Builds and pushes to Docker Hub