2021-12-05 16:24:03 +01:00
|
|
|
services:
|
2025-11-18 20:00:06 +05:30
|
|
|
app:
|
|
|
|
|
build:
|
|
|
|
|
context: .
|
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
|
image: spring-petclinic:latest
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
container_name: spring-petclinic-app
|
2025-11-18 20:00:06 +05:30
|
|
|
ports:
|
|
|
|
|
- "8080:8080"
|
|
|
|
|
environment:
|
|
|
|
|
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-mysql}
|
|
|
|
|
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL:-jdbc:mysql://mysql:3306/petclinic?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC}
|
|
|
|
|
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME:-petclinic}
|
|
|
|
|
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD:-petclinic}
|
|
|
|
|
depends_on:
|
|
|
|
|
mysql:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
restart: unless-stopped
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080/actuator/health || exit 1"]
|
|
|
|
|
interval: 30s
|
|
|
|
|
timeout: 10s
|
|
|
|
|
retries: 3
|
|
|
|
|
start_period: 40s
|
|
|
|
|
networks:
|
|
|
|
|
- petclinic-network
|
2025-11-18 20:00:06 +05:30
|
|
|
|
2021-12-05 16:24:03 +01:00
|
|
|
mysql:
|
2025-06-04 22:21:33 +02:00
|
|
|
image: mysql:9.2
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
container_name: spring-petclinic-mysql
|
2021-12-05 16:24:03 +01:00
|
|
|
ports:
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
- "${MYSQL_PORT:-3306}:3306"
|
2021-12-05 16:24:03 +01:00
|
|
|
environment:
|
2025-11-18 20:00:06 +05:30
|
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
|
|
|
|
|
MYSQL_USER: ${SPRING_DATASOURCE_USERNAME:-petclinic}
|
|
|
|
|
MYSQL_PASSWORD: ${SPRING_DATASOURCE_PASSWORD:-petclinic}
|
|
|
|
|
MYSQL_DATABASE: ${MYSQL_DATABASE:-petclinic}
|
|
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: "false"
|
2021-12-05 16:24:03 +01:00
|
|
|
volumes:
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
- mysql-data:/var/lib/mysql
|
2021-12-05 16:24:03 +01:00
|
|
|
- "./conf.d:/etc/mysql/conf.d:ro"
|
2025-11-18 20:00:06 +05:30
|
|
|
healthcheck:
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-root}"]
|
2025-11-18 20:00:06 +05:30
|
|
|
interval: 10s
|
|
|
|
|
timeout: 5s
|
|
|
|
|
retries: 10
|
|
|
|
|
start_period: 20s
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
restart: unless-stopped
|
|
|
|
|
networks:
|
|
|
|
|
- petclinic-network
|
2025-11-18 20:00:06 +05:30
|
|
|
|
2021-12-07 12:46:58 +01:00
|
|
|
postgres:
|
2025-10-04 10:32:59 +02:00
|
|
|
image: postgres:18.0
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
container_name: spring-petclinic-postgres
|
2021-12-07 12:46:58 +01:00
|
|
|
ports:
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
- "${POSTGRES_PORT:-5432}:5432"
|
2021-12-07 12:46:58 +01:00
|
|
|
environment:
|
2025-11-18 20:00:06 +05:30
|
|
|
POSTGRES_PASSWORD: ${SPRING_DATASOURCE_PASSWORD:-petclinic}
|
|
|
|
|
POSTGRES_USER: ${SPRING_DATASOURCE_USERNAME:-petclinic}
|
|
|
|
|
POSTGRES_DB: ${POSTGRES_DB:-petclinic}
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
volumes:
|
|
|
|
|
- postgres-data:/var/lib/postgresql/data
|
2025-11-18 20:00:06 +05:30
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD-SHELL", "pg_isready -U ${SPRING_DATASOURCE_USERNAME:-petclinic}"]
|
|
|
|
|
interval: 10s
|
|
|
|
|
timeout: 5s
|
|
|
|
|
retries: 10
|
|
|
|
|
start_period: 20s
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
restart: unless-stopped
|
2025-11-18 20:00:06 +05:30
|
|
|
profiles:
|
|
|
|
|
- postgres
|
Improve Docker and CI/CD configuration with best practices
- Dockerfile: Add non-root user, healthcheck, optimized layer caching
- docker-compose.yml: Add healthchecks, data volumes, networking, better configuration
- CI/CD: Add multi-platform builds, image testing, multiple tags, metadata
- .dockerignore: Comprehensive exclusions for faster builds
These improvements enhance security, reliability, and maintainability
following Docker and Spring Boot best practices.
Signed-off-by: Bhavesh Khandelwal <bhaveshkhandelwal1232@gmail.com>
2025-12-14 10:49:10 +05:30
|
|
|
networks:
|
|
|
|
|
- petclinic-network
|
|
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
|
mysql-data:
|
|
|
|
|
driver: local
|
|
|
|
|
postgres-data:
|
|
|
|
|
driver: local
|
|
|
|
|
|
|
|
|
|
networks:
|
|
|
|
|
petclinic-network:
|
|
|
|
|
driver: bridge
|