sha256:67c04b636a8d311298dcd40e9204cc0b3db11099cc6e7c6341cc1caaa688e3f6
Last pushed
6 months by jnaranjo2023
Type
Compose
Manifest digest
sha256:67c04b636a8d311298dcd40e9204cc0b3db11099cc6e7c6341cc1caaa688e3f6
services:
mysql-db:
# Official MySQL image [cite: 288, 1047]
image: mysql:9.6
container_name: mysql-db
environment:
# Define password and DB name with default values [cite: 1557, 1558, 1575]
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD:-pass}
- MYSQL_DATABASE=${DB_NAME:-myapp_db}
healthcheck:
# Command to verify that MySQL is ready for connections [cite: 1331, 1370, 1580]
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$$MYSQL_ROOT_PASSWORD" ]
interval: 5s
timeout: 5s
start_period: 10s
retries: 5
volumes:
# Named volume for persistence (necessary for OCI Artifacts) [cite: 1483, 1492, 1578]
- db_data:/var/lib/mysql
app:
# Your image published on DockerHub [cite: 414, 1207]
image: marcoshm851/practica2daw:latest #PUT YOUR USERNAME HERE Username/practica2daw:latest
container_name: spring-app
depends_on:
mysql-db:
# Wait for the DB healthcheck to be successful [cite: 1346, 1362, 1477, 1572]
condition: service_healthy
ports:
# Port 8443 for local HTTPS access (localhost:8443)
- "8443:8443"
environment:
# Spring Boot configuration via environment variables [cite: 1217, 1357, 1471, 1565]
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql-db:3306/${DB_NAME:-myapp_db}?createDatabaseIfNotExist=true
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWORD:-pass}
# Variable to toggle between 'create' (initialization) and 'none' modes
- SPRING_JPA_HIBERNATE_DDL_AUTO=${DDL_AUTO:-none}
#Enhance loading times
- SPRING_WEB_RESOURCES_CACHE_CACHECONTROL_NO_CACHE=true
- SPRING_WEB_RESOURCES_CACHE_CACHECONTROL_NO_STORE=true
volumes:
# Declaration of the volume to persist DB data [cite: 1490, 1586]
db_data:
docker compose -f oci://jnaranjo2023/practica2daw-compose:latest upUse the above command to pull and run the Compose file. Learn more.
MySQL is a widely used, open-source relational database management system (RDBMS).
Pulls
1B+
Stars
16185
Last Updated
7 days