#!/bin/bash
# prepare-app.sh: Prepares the Docker application environment.
# This script builds Docker images, and creates necessary networks and named volumes.

# Build the Docker images defined in docker-compose.yaml
docker-compose build

# Create the application network if it doesn't exist (optional, as docker-compose creates one automatically)
docker network create app-network 2>/dev/null || echo "Network 'app-network' already exists."

# Create the named volume for MySQL database persistence (optional, docker-compose will create it if missing)
docker volume create db_data 2>/dev/null || echo "Volume 'db_data' already exists."

echo "Preparing app completed."
