Files
scripts/compose.yaml
T

51 lines
1.5 KiB
YAML

---
services:
app:
build: .
container_name: spaces
ports:
- "2025:2025"
volumes:
# Mounts the project code into the container.
# This makes git pulls faster after the first run.
- ./web:/var/www/html
environment:
# --- Git Settings ---
# ⚠️ Use a secure Personal Access Token (PAT) for the URL
- GIT_REPO_URL=https://${GITHUB_USER}:${GITHUB_PAT}@github.com/${GITHUB_USER}/${SPACES_REPO}.git
- GIT_BRANCH=main
# --- Database Connection Settings (for your PHP app) ---
- DB_HOST=db
- DB_DATABASE=mydatabase
- DB_USER=myuser
- DB_PASSWORD=mypassword
# --- Backup Script Settings ---
# These credentials are used by mysqldump inside the container
- MARIADB_USER=${DB_USER}
- MARIADB_PASSWORD=${DB_PASSWORD}
- MARIADB_DATABASE=${DB_DATABASE}
- MARIADB_HOST=db # The service name from this compose file
depends_on:
- db # Ensures the 'db' container starts before the 'app' container
db:
image: mariadb:latest
container_name: spaces_db
restart: unless-stopped
volumes:
# Persists database data on the host machine
- db_data:/var/lib/mysql
environment:
- MARIADB_ROOT_PASSWORD=supersecretrootpassword
- MARIADB_DATABASE=mydatabase
- MARIADB_USER=myuser
- MARIADB_PASSWORD=mypassword
ports:
# Optional: Expose DB port to host for debugging with a GUI client
- "3306:3306"
volumes:
db_data: # Defines the named volume for the database