first code commit from mac; changed docker setup for new mac development environment

This commit is contained in:
nisch.codes 2025-07-27 20:32:50 +02:00
parent 5882940435
commit cfdd150ca0
8 changed files with 65 additions and 34 deletions

3
.gitignore vendored
View File

@ -8,6 +8,9 @@ composer.phar
# ignore .test folders # ignore .test folders
.test .test
#ignore apple files
.DS_Store
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock # composer.lock

View File

@ -18,9 +18,11 @@
"require": {}, "require": {},
"scripts": { "scripts": {
"setup": "php public/index.php run:setup", "setup": "php public/index.php run:setup",
"serve-dev": "podman-compose up -d --build --build-arg INSTALL_XDEBUG=true", "docker-dev-init": "docker-compose build --build-arg INSTALL_XDEBUG=true",
"stop-serve-dev": "podman-compose down", "serve-dev": "docker-compose up -d",
"serve": "docker-compose up -d --build", "stop-serve-dev": "docker-compose down",
"docker-init": "docker-compose build --build-arg INSTALL_XDEBUG=false",
"serve": "docker-compose up -d",
"stop-serve": "docker-compose down" "stop-serve": "docker-compose down"
} }
} }

View File

@ -1,55 +1,36 @@
version: "3.8"
services: services:
php: php:
build: build:
context: . context: .
dockerfile: docker/php/Dockerfile dockerfile: docker/php/Dockerfile
args: args:
INSTALL_XDEBUG: "false" INSTALL_XDEBUG: ${ENABLE_XDEBUG}
environment:
ENABLE_XDEBUG: ${ENABLE_XDEBUG}
container_name: app-php container_name: app-php
working_dir: /var/www/html working_dir: /var/www/html
volumes: volumes:
- ./docker/php/entrypoint.sh:/entrypoint.sh
- ./:/var/www/html:Z - ./:/var/www/html:Z
extra_hosts: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
entrypoint: > entrypoint: [ "sh", "/entrypoint.sh" ]
sh -c "
if [ ! -d vendor ]; then
composer install --no-dev --optimize-autoloader;
php scripts/setup.php;
fi;
php-fpm
"
networks: networks:
- appnet - apps
web: web:
image: docker.io/library/httpd:2.4 image: docker.io/library/httpd:2.4
container_name: app-web container_name: app-web
depends_on: [php] depends_on: [php]
ports: ports:
- "8080:80" - "8000:80"
volumes: volumes:
- ./docker/apache/entrypoint.sh:/entrypoint.sh
- ./public:/usr/local/apache2/htdocs:Z - ./public:/usr/local/apache2/htdocs:Z
- ./docker/apache/vhost.conf:/usr/local/apache2/conf/extra/vhost.conf:ro,Z - ./docker/apache/vhost.conf:/usr/local/apache2/conf/extra/vhost.conf:ro,Z
command: > command: [ "sh", "/entrypoint.sh" ]
sh -c "
# ───────── Module laden ─────────
echo 'LoadModule rewrite_module modules/mod_rewrite.so' \
>> /usr/local/apache2/conf/httpd.conf;
echo 'LoadModule proxy_module modules/mod_proxy.so' \
>> /usr/local/apache2/conf/httpd.conf;
echo 'LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so' \
>> /usr/local/apache2/conf/httpd.conf;
# ───────── VHost aktivieren ─────────
echo 'Include conf/extra/vhost.conf' \
>> /usr/local/apache2/conf/httpd.conf;
httpd-foreground
"
networks: networks:
- appnet - apps
networks: networks:
appnet: apps:
driver: bridge

17
docker/apache/entrypoint.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
echo "🚀 Apache Setup beginnt..."
# ───────── Module laden ─────────
echo '📦 Lade Apache-Module...'
echo 'LoadModule rewrite_module modules/mod_rewrite.so' >> /usr/local/apache2/conf/httpd.conf
echo 'LoadModule proxy_module modules/mod_proxy.so' >> /usr/local/apache2/conf/httpd.conf
echo 'LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so' >> /usr/local/apache2/conf/httpd.conf
# ───────── VHost aktivieren ─────────
echo '🔧 Aktiviere vhost.conf...'
echo 'Include conf/extra/vhost.conf' >> /usr/local/apache2/conf/httpd.conf
echo "✅ Starte Apache im Vordergrund..."
exec httpd-foreground

View File

@ -6,9 +6,13 @@ ARG INSTALL_XDEBUG=false
# System-Tools für pecl # System-Tools für pecl
RUN apt-get update \ RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git unzip \ git unzip wget curl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer --version
# Conditionally install Xdebug # Conditionally install Xdebug
RUN if [ "$INSTALL_XDEBUG" = "true" ]; then \ RUN if [ "$INSTALL_XDEBUG" = "true" ]; then \
pecl install xdebug \ pecl install xdebug \

16
docker/php/entrypoint.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
set -e
echo "🚀 Starte Container Setup..."
# Vendor check
if [ ! -d vendor ]; then
echo "📦 Installiere Composer-Abhängigkeiten..."
composer install --no-dev --optimize-autoloader
echo "⚙️ Führe Setup-Script aus..."
php public/index.php
fi
echo "✅ Starte PHP-FPM..."
exec php-fpm

View File

@ -1,4 +1,10 @@
# Configure if Docker Image should include the xdebug extension or not
ENABLE_XDEBUG=true
# define the application context
APP_CONTEXT="Production" APP_CONTEXT="Production"
# some 3rd party environment configurations
HOLIDAY_SERVER="https://get.api-feiertage.de?years=$currentYear&states=nw" HOLIDAY_SERVER="https://get.api-feiertage.de?years=$currentYear&states=nw"
SERVER="https://your.next.cloud/apps/tables/api/1/tables/[$yourTableId]/rows" SERVER="https://your.next.cloud/apps/tables/api/1/tables/[$yourTableId]/rows"
LOGIN="yourlogin@next.cloud:YOURPASSWORD" LOGIN="yourlogin@next.cloud:YOURPASSWORD"

View File

@ -103,6 +103,7 @@ class Application {
} }
private static function initConsole() { private static function initConsole() {
echo "I should do something";
} }
@ -138,6 +139,7 @@ class Application {
} }
private static function runConsole() { private static function runConsole() {
echo "I automatically know that I run on the console";
} }