This Docker image provides the backend for the WebChat application, built with Spring Boot.
The backend handles:
The image is designed to be environment-agnostic, with all database and cache configurations provided via environment variables, making it easy to deploy in Docker Compose or Docker Swarm.
The following environment variables must be set when running the container:
| Variable | Description | Example |
|---|---|---|
SPRING_DATASOURCE_URL | JDBC URL for PostgreSQL database | jdbc:postgresql://postgres:5432/webchat |
SPRING_DATASOURCE_USERNAME | PostgreSQL username | webchat_user |
SPRING_DATASOURCE_PASSWORD | PostgreSQL password | secret |
SPRING_CACHE_TYPE | Cache type for Spring Boot | redis |
SPRING_DATA_REDIS_HOST | Redis server host | redis |
SPRING_DATA_REDIS_PORT | Redis server port | 6379 |
SPRING_PROFILES_ACTIVE | Spring profile (optional, e.g., prod/dev) | prod |
Example: These can be set via Docker Compose, environment files, or Docker Swarm secrets.
version: "3.9"
services:
backend:
image: lahiru/webchat-backend:v1.0
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/webchat
- SPRING_DATASOURCE_USERNAME=webchat_user
- SPRING_DATASOURCE_PASSWORD=secret
- SPRING_CACHE_TYPE=redis
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATA_REDIS_PORT=6379
ports:
- "8080:8080"
depends_on:
- postgres
- redis
postgres:
image: postgres:15-alpine
environment:
- POSTGRES_DB=webchat
- POSTGRES_USER=webchat_user
- POSTGRES_PASSWORD=secret
volumes:
- pgdata:/var/lib/postgresql/data
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
pgdata:
Content type
Image
Digest
sha256:120aa57cc…
Size
171.4 MB
Last updated
about 1 year ago
docker pull lahirudilhara/webchat-backend