simple-java-app / README.md
GitHub Actions
deploy: deploy application container to Hugging Face
d7f1ba4
|
Raw History Blame Contribute Delete
2.68 kB
---
title: SimpleJavaApp
emoji: πŸš€
colorFrom: blue
colorTo: green
sdk: docker
app_port: 8080
pinned: false
---
# SimpleJavaApp πŸš€
A modern and production-ready Spring Boot application containerized for easy, free cloud deployment (Render, Koyeb, OCI) .
This project features a fully configured **Student Management Service** and comes out of the box with Docker multi-stage build optimization and automated JVM memory tuning specifically designed to prevent Out of Memory (OOM) errors on restricted free-tier hosting platforms.
---
## 🌟 Key Features
* **Spring Boot Core**: Web, JPA, H2 In-Memory database, and custom library starter support.
* **REST APIs**: Full CRUD capabilities for student resource management.
* **Self-Contained Dependency Management**: Houses the custom `spring-boot-mcp-starter` library locally in `/libs` so that the cloud build compiles flawlessly without external repositories.
* **Cloud-Optimized Dockerfile**: Uses a multi-stage `eclipse-temurin` Alpine Docker image to produce a ultra-lightweight running container.
* **Smart JVM Memory Constraints**: Automatically restricts JVM heap space to `75%` of container memory to survive restricted hosting tiers.
---
## πŸ› οΈ How to Run Locally
### Prerequisites
* **Java SDK**: Version 21
* **Gradle**: Handled automatically via `./gradlew`
### Run from Terminal
Clone the repository and run:
```bash
# Run the application
./gradlew bootRun
```
The application will start on `http://localhost:8080`.
---
## ☁️ How to Deploy Free on the Cloud (Render)
This application is ready to deploy to **Render** with a single click.
1. **Push your code to GitHub**: Create a repository and push this project directory.
2. **Log into Render**: Connect using your GitHub account at [Render Dashboard](https://dashboard.render.com).
3. **Create a New Web Service**:
* Click **New +** > **Web Service**.
* Select your `SimpleJavaApp` repository.
4. **Configure Settings**:
* **Runtime**: `Docker`
* **Instance Type**: `Free`
5. **Launch**: Click **Create Web Service**.
Render will automatically read the `Dockerfile`, package the local libraries, compile your source code, and serve it live!
---
## πŸ“ Project Structure
```text
β”œβ”€β”€ libs/ # Local jar dependencies (spring-boot-mcp-starter)
β”œβ”€β”€ src/ # Application source code
β”‚ └── main/java/com/... # Spring controllers, services, repositories
β”œβ”€β”€ Dockerfile # High-efficiency multi-stage Docker build
β”œβ”€β”€ build.gradle # Build and dependency configuration
└── README.md # Project documentation
```