podman compose, etc.

This commit is contained in:
2025-08-24 12:58:13 -06:00
parent 06c4e6f73b
commit 2af45db396
3 changed files with 52 additions and 57 deletions
+51 -34
View File
@@ -1,50 +1,67 @@
---
services:
app:
build: .
spaces:
build: ./web
container_name: spaces
ports:
- "2025:2025"
- "2025:2025" # Standard HTTP port for the web server
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
- spaces_api
db:
image: mariadb:latest
spaces_api:
build: ./api
container_name: spaces_api
restart: unless-stopped
ports:
- "7476:7476"
volumes:
- spaces_api_logs:/app/logs # Persistent volume for logs
depends_on:
spaces_db:
condition: service_healthy
environment:
# Pass DB credentials to the Go API
- VIPER_DBUSER=vintage
- VIPER_DBPASS=changeme
- VIPER_DBNAME=vintagecoding
- VIPER_DBHOST=spaces_db
spaces_api_tester:
build: ./api
container_name: spaces_api_tester
depends_on:
spaces_db:
condition: service_healthy
environment:
- VIPER_DBUSER=vintage
- VIPER_DBPASS=changeme
- VIPER_DBNAME=vintagecoding_test
- VIPER_DBHOST=spaces_db
- VIPER_DBPORT=3306
command: ["go", "test", "-v"]
spaces_db:
image: docker.io/mariadb:latest
container_name: spaces_db
restart: unless-stopped
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 3
volumes:
# Persists database data on the host machine
- db_data:/var/lib/mysql
- spaces_db_data:/var/lib/mysql
environment:
- MARIADB_ROOT_PASSWORD=supersecretrootpassword
- MARIADB_DATABASE=mydatabase
- MARIADB_USER=myuser
- MARIADB_PASSWORD=mypassword
- MARIADB_ROOT_PASSWORD=QuaxlyQueen5012!
- MARIADB_DATABASE=vintagecoding
- MARIADB_USER=vintage
- MARIADB_PASSWORD=changeme
- MARIADB_EXTRA_DATABASES=vintagecoding_test
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
spaces_db_data:
spaces_api_logs: