52 - Move dev compose to docker/dev/ to match the standard layout

This commit is contained in:
myrmidex 2026-08-19 00:13:46 +02:00
parent ba7df4b5ad
commit cca3f29823
4 changed files with 33 additions and 24 deletions

View file

@ -13,7 +13,7 @@ ## Reporting issues
## Development setup ## Development setup
Requires PHP 8.2+ and a container runtime (Podman or Docker). The development Requires PHP 8.2+ and a container runtime (Podman or Docker). The development
environment runs in containers defined by `docker-compose.yml`. environment runs in containers defined by `docker/dev/docker-compose.yml`.
On NixOS, or anywhere with Nix installed: On NixOS, or anywhere with Nix installed:
@ -49,7 +49,7 @@ ## Development setup
| Mailhog | http://localhost:8025 | | Mailhog | http://localhost:8025 |
| MariaDB | localhost:3306 | | MariaDB | localhost:3306 |
Without Nix, start the same containers directly from `docker-compose.yml`. Without Nix, start the same containers directly from `docker/dev/docker-compose.yml`.
Contributions improving the setup instructions for other platforms are welcome. Contributions improving the setup instructions for other platforms are welcome.
## Before opening a pull request ## Before opening a pull request

View file

@ -18,7 +18,7 @@ ## 🚀 Self-hosting
The production image is available at `forge.lvl0.xyz/lvl0/dishplanner:latest`. See [CHANGELOG.md](CHANGELOG.md) before upgrading. The production image is available at `forge.lvl0.xyz/lvl0/dishplanner:latest`. See [CHANGELOG.md](CHANGELOG.md) before upgrading.
### docker-compose.yml ### docker-compose.prod.yml
```yaml ```yaml
services: services:

View file

@ -1,10 +1,11 @@
# Local Development Docker Compose # Local Development Docker Compose
name: dishplanner
version: '3.8' version: '3.8'
services: services:
app: app:
build: build:
context: . context: ../..
dockerfile: Dockerfile.dev dockerfile: Dockerfile.dev
container_name: dishplanner_app container_name: dishplanner_app
restart: unless-stopped restart: unless-stopped
@ -41,7 +42,7 @@ services:
VITE_HOST: "0.0.0.0" VITE_HOST: "0.0.0.0"
volumes: volumes:
# Mount entire project for hot reload with SELinux context # Mount entire project for hot reload with SELinux context
- .:/app:Z - ../..:/app:Z
# Named volumes for performance and permission isolation # Named volumes for performance and permission isolation
- app_vendor:/app/vendor - app_vendor:/app/vendor
- app_node_modules:/app/node_modules - app_node_modules:/app/node_modules
@ -64,7 +65,7 @@ services:
volumes: volumes:
- db_data:/var/lib/mysql - db_data:/var/lib/mysql
# Initialize with SQL scripts # Initialize with SQL scripts
- ./docker/mysql-init:/docker-entrypoint-initdb.d - ../mysql-init:/docker-entrypoint-initdb.d
healthcheck: healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s interval: 10s

View file

@ -29,59 +29,67 @@ pkgs.mkShell {
# Use keep-id for proper permission mapping in rootless podman # Use keep-id for proper permission mapping in rootless podman
export PODMAN_USERNS=keep-id export PODMAN_USERNS=keep-id
# Compose file location
COMPOSE_FILE="$PWD/docker/dev/docker-compose.yml"
# ===================
# ALIASES
# ===================
alias pc='podman-compose -f $COMPOSE_FILE'
# Define helper functions # Define helper functions
dev-rebuild() { dev-rebuild() {
echo "🔨 Rebuilding development environment..." echo "🔨 Rebuilding development environment..."
PODMAN_USERNS=keep-id podman-compose down -v PODMAN_USERNS=keep-id podman-compose -f $COMPOSE_FILE down -v
PODMAN_USERNS=keep-id podman-compose build --no-cache app PODMAN_USERNS=keep-id podman-compose -f $COMPOSE_FILE build --no-cache app
PODMAN_USERNS=keep-id podman-compose up -d PODMAN_USERNS=keep-id podman-compose -f $COMPOSE_FILE up -d
echo " Rebuild complete! Check logs with: dev-logs" echo " Rebuild complete! Check logs with: dev-logs"
} }
dev-rebuild-quick() { dev-rebuild-quick() {
echo " Quick rebuild (keeping volumes)..." echo " Quick rebuild (keeping volumes)..."
PODMAN_USERNS=keep-id podman-compose down PODMAN_USERNS=keep-id podman-compose -f $COMPOSE_FILE down
PODMAN_USERNS=keep-id podman-compose build app PODMAN_USERNS=keep-id podman-compose -f $COMPOSE_FILE build app
PODMAN_USERNS=keep-id podman-compose up -d PODMAN_USERNS=keep-id podman-compose -f $COMPOSE_FILE up -d
echo " Quick rebuild complete!" echo " Quick rebuild complete!"
} }
dev-up() { dev-up() {
echo "🚀 Starting development environment..." echo "🚀 Starting development environment..."
PODMAN_USERNS=keep-id podman-compose up -d PODMAN_USERNS=keep-id podman-compose -f $COMPOSE_FILE up -d
echo " Dev environment started!" echo " Dev environment started!"
} }
dev-down() { dev-down() {
echo "🛑 Stopping development environment..." echo "🛑 Stopping development environment..."
podman-compose down podman-compose -f $COMPOSE_FILE down
echo " Dev environment stopped!" echo " Dev environment stopped!"
} }
dev-restart() { dev-restart() {
echo "🔄 Restarting development environment..." echo "🔄 Restarting development environment..."
podman-compose restart podman-compose -f $COMPOSE_FILE restart
echo " Dev environment restarted!" echo " Dev environment restarted!"
} }
dev-logs() { dev-logs() {
podman-compose logs -f "$@" podman-compose -f $COMPOSE_FILE logs -f "$@"
} }
dev-logs-db() { dev-logs-db() {
podman-compose logs -f db "$@" podman-compose -f $COMPOSE_FILE logs -f db "$@"
} }
dev-shell() { dev-shell() {
podman-compose exec app sh podman-compose -f $COMPOSE_FILE exec app sh
} }
dev-artisan() { dev-artisan() {
podman-compose exec app php artisan "$@" podman-compose -f $COMPOSE_FILE exec app php artisan "$@"
} }
dev-test() { dev-test() {
podman-compose exec -T app env $(grep -vE '^\s*(#|$)' .env.testing) php -d memory_limit=512M vendor/bin/phpunit "$@" podman-compose -f $COMPOSE_FILE exec -T app env $(grep -vE '^\s*(#|$)' .env.testing) php -d memory_limit=512M vendor/bin/phpunit "$@"
} }
dev-fix-permissions() { dev-fix-permissions() {
@ -171,12 +179,12 @@ pkgs.mkShell {
echo "" echo ""
# Auto-start prompt # Auto-start prompt
if [ -f "docker-compose.yml" ]; then if [ -f "$COMPOSE_FILE" ]; then
read -p "Start development containers? (y/N) " -n 1 -r read -p "Start development containers? (y/N) " -n 1 -r
echo echo
if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Starting containers..." echo "Starting containers..."
podman-compose up -d podman-compose -f $COMPOSE_FILE up -d
# Wait a moment for containers to start # Wait a moment for containers to start
sleep 3 sleep 3
@ -188,8 +196,8 @@ pkgs.mkShell {
echo " Mailhog: http://localhost:8025" echo " Mailhog: http://localhost:8025"
echo " MariaDB: localhost:3306" echo " MariaDB: localhost:3306"
echo "" echo ""
echo "Run 'podman-compose logs -f app' to follow logs" echo "Run 'pc logs -f app' to follow logs"
fi fi
fi fi
''; '';
} }