A full-featured blogging platform built with Spring Boot, Thymeleaf, JPA, and MySQL.
741
A lightweight Spring Boot blogging application containerized for easy deployment. Demonstrates a full CRUD (Create, Read, Update, Delete) flow for articles using Spring Data JPA, Thymeleaf templates, and UUID primary keys stored as BINARY(16).
This project also features fully configured PWA (Progressive Web App) support.
To quickly start the application and its database using Docker, run the following commands.
docker run -d \
--name mysql-blog \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=blogdb \
-e MYSQL_USER=bloguser \
-e MYSQL_PASSWORD=password \
-p 3306:3306 \
mysql:8.0
Note: The application container is linked to the MySQL container.
docker run -d \
--name blogging-app \
-p 8080:8080 \
-e DB_URL=jdbc:mysql://mysql-blog:3306/blogdb?useSSL=false&serverTimezone=UTC \
-e DB_USER=bloguser \
-e DB_PASS=password \
--link mysql-blog \
prancodes/blogging-app:latest
Create a docker-compose.yml file with the following content to orchestrate both services automatically:
version: '3.8'
services:
app:
image: prancodes/blogging-app:latest
container_name: blog-spring-web
ports:
- "8080:8080"
environment:
- DB_URL=jdbc:mysql://db:3306/blogdb?useSSL=false&serverTimezone=UTC
- DB_USER=bloguser
- DB_PASS=password
- SPRING_PROFILES_ACTIVE=dev
depends_on:
- db
networks:
- blog-network
db:
image: mysql:8.0
container_name: blog-mysql-db
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=blogdb
- MYSQL_USER=bloguser
- MYSQL_PASSWORD=password
volumes:
- db-data:/var/lib/mysql
networks:
- blog-network
volumes:
db-data:
networks:
blog-network:
driver: bridge
Start the stack:
docker compose up -d
The container is configured using the following environment variables. You can override them at runtime.
| Variable | Description | Example |
|---|---|---|
DB_URL | JDBC URL for MySQL | jdbc:mysql://host:3306/db... |
DB_USER | Database username | bloguser |
DB_PASS | Database password | secret |
SPRING_PROFILES_ACTIVE | Active Spring profile | dev or prod |
site.webmanifest and Service Worker (sw.js) allow the app to be installed natively on Android, iOS, and Desktop.UUID with Hibernate GenerationType.UUID, optimized as BINARY(16) for performance.@NotBlank, @Size).| Port | Description |
|---|---|
8080 | Blogging Application Web Interface |
3306 | MySQL Database (if exposed via Compose) |
š§š»āš» Developed and maintained by Pranjal Singhā
Project source code is available on GitHub Repositoryā .
Content type
Image
Digest
sha256:d28479507ā¦
Size
130.4 MB
Last updated
8 months ago
docker pull prancodes/blogging-app