Skip to content

Commit f7e35a5

Browse files
authored
Merge pull request #11 from kariricode/develop
Develop
2 parents 0de6593 + 59a9636 commit f7e35a5

9 files changed

Lines changed: 28 additions & 1417 deletions

File tree

.env.example

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22
# PHP API Stack — Environment Configuration
33
# Image: kariricode/php-api-stack
44
# ============================================
5-
# Demo Mode (optional)
6-
# Set to 'true' to install demo landing page when no application exists
7-
DEMO_MODE=true
8-
# Mode debug (optional) 0=inactive 1=acrive
9-
ENABLE_XDEBUG=1
10-
# Health Check Installation (optional)
11-
# Set to 'true' to install health check endpoint
12-
# Automatically enabled when DEMO_MODE=true
13-
HEALTH_CHECK_INSTALL=true
14-
# ============================================
155
# Application
166
# ============================================
177
APP_NAME=php-api-stack
@@ -110,7 +100,7 @@ PHP_FPM_REQUEST_SLOWLOG_TIMEOUT=30s
110100
PHP_OPCACHE_ENABLE=1
111101
PHP_OPCACHE_MEMORY=256
112102
PHP_OPCACHE_MAX_FILES=20000
113-
PHP_OPCACHE_VALIDATE_TIMESTAMPS=0
103+
PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
114104
PHP_OPCACHE_REVALIDATE_FREQ=0
115105
PHP_OPCACHE_JIT=tracing
116106
PHP_OPCACHE_JIT_BUFFER_SIZE=128M

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
./app/public/health.php
1515
./app/public/index.php
1616

17+
# Public directory (application-specific files)
18+
/public/
19+
1720
# Logs
1821
./logs/
1922
*.log

Dockerfile

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -425,20 +425,6 @@ COPY scripts/quick-start.sh /usr/local/bin/quick-start
425425

426426
RUN chmod +x /usr/local/bin/docker-entrypoint /usr/local/bin/process-configs /usr/local/bin/quick-start
427427

428-
# ----------------------------------------------------------------------------
429-
# Healthcheck templates (staged, published at runtime)
430-
# ----------------------------------------------------------------------------
431-
RUN install -d -m 0755 /opt/php-api-stack-templates
432-
433-
COPY --chown=nginx:nginx php/index.php /opt/php-api-stack-templates/index.php
434-
COPY --chown=nginx:nginx php/health.php /opt/php-api-stack-templates/health.php
435-
436-
# Validate syntax at build time
437-
RUN set -eux; \
438-
php -l /opt/php-api-stack-templates/index.php; \
439-
php -l /opt/php-api-stack-templates/health.php; \
440-
echo "✓ Healthcheck templates validated successfully"
441-
442428
WORKDIR /var/www/html
443429

444430
# ============================================================================

Makefile

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,8 @@ ALPINE_VERSION?=3.21
5454
COMPOSER_VERSION?=2.8.12
5555
SYMFONY_CLI_VERSION?=5.15.1
5656

57-
DEMO_MODE ?= false
58-
HEALTH_CHECK_INSTALL ?= false
59-
6057
# Common build args block
6158
BUILD_ARGS := \
62-
--build-arg DEMO_MODE=$(DEMO_MODE) \
63-
--build-arg HEALTH_CHECK_INSTALL=$(HEALTH_CHECK_INSTALL) \
6459
--build-arg VERSION=$(VERSION) \
6560
--build-arg PHP_VERSION=$(PHP_VERSION) \
6661
--build-arg PHP_CORE_EXTENSIONS=$(PHP_CORE_EXTENSIONS) \
@@ -85,9 +80,7 @@ PROD_BUILD_ARGS := \
8580
--build-arg PHP_OPCACHE_ENABLE=1 \
8681
--build-arg PHP_OPCACHE_MEMORY_CONSUMPTION=256 \
8782
--build-arg XDEBUG_ENABLE=0 \
88-
--build-arg APP_DEBUG=false \
89-
--build-arg DEMO_MODE=false \
90-
--build-arg HEALTH_CHECK_INSTALL=false
83+
--build-arg APP_DEBUG=false
9184

9285

9386
# Development build args
@@ -98,10 +91,8 @@ XDEBUG_VERSION ?= 3.4.6
9891
DEV_BUILD_ARGS := \
9992
--build-arg APP_ENV=development \
10093
--build-arg APP_DEBUG=true \
101-
--build-arg DEMO_MODE=true \
10294
--build-arg SYMFONY_CLI_VERSION=$(SYMFONY_CLI_VERSION) \
10395
--build-arg XDEBUG_VERSION=$(XDEBUG_VERSION) \
104-
--build-arg HEALTH_CHECK_INSTALL=true \
10596
--build-arg XDEBUG_ENABLE=$(XDEBUG_ENABLE)
10697

10798
.PHONY: help
@@ -186,11 +177,10 @@ build-base: ## Build base image (target=base) - for debugging only
186177

187178
.PHONY: build-test
188179
build-test: ## Build test image (production with health check)
189-
@echo "$(GREEN)Building test image with comprehensive health check...$(NC)"
180+
@echo "$(GREEN)Building test image...$(NC)"
190181
@docker build \
191182
$(BUILD_ARGS) \
192183
$(PROD_BUILD_ARGS) \
193-
--build-arg HEALTH_CHECK_INSTALL=true \
194184
--target production \
195185
-t $(FULL_IMAGE):test \
196186
.
@@ -229,23 +219,28 @@ run-dev: ## Run dev container with Xdebug
229219
@echo "$(GREEN)Starting dev container...$(NC)"
230220
@docker stop $(DEV_CONTAINER) >/dev/null 2>&1 || true
231221
@docker rm $(DEV_CONTAINER) >/dev/null 2>&1 || true
222+
232223
@if docker ps --format '{{.Ports}}' | grep -q '$(DEV_PORT)->'; then \
233224
echo "$(RED)X Port $(DEV_PORT) is already in use!$(NC)"; \
234225
echo "$(YELLOW)Try another port:$(NC) make run-dev DEV_PORT=9000"; \
235226
exit 1; \
236227
fi
228+
237229
@docker run -d \
238230
--name $(DEV_CONTAINER) \
239231
-p $(DEV_PORT):80 \
240232
-p 9003:9003 \
241233
--env-file $(ENV_FILE) \
242234
-e APP_ENV=development \
243235
-e XDEBUG_ENABLE=1 \
236+
-v $(PWD):/var/www/html \
244237
-v $(PWD)/logs:/var/log \
245238
$(FULL_IMAGE):$(IMAGE_TAG)
239+
246240
@echo "$(GREEN)OK: Dev container running at http://localhost:$(DEV_PORT)$(NC)"
247241
@echo "$(CYAN)Xdebug enabled on port 9003$(NC)"
248242

243+
249244
.PHONY: run-test
250245
run-test: build-test ## Run test container
251246
@echo "$(GREEN)Starting test container...$(NC)"

docker-compose.example.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ services:
33
image: kariricode/php-api-stack:latest
44
container_name: php-api-stack
55
restart: unless-stopped
6-
environment:
7-
- DEMO_MODE=true
8-
- HEALTH_CHECK_INSTALL=true
96
env_file:
107
- .env
118
ports:

docker-entrypoint.sh

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -180,30 +180,6 @@ if [ -f "/var/www/html/bin/console" ]; then
180180
fi
181181
fi
182182

183-
# ----------------------------------------------------------------------------
184-
# DEMO_MODE
185-
# ----------------------------------------------------------------------------
186-
if [ "${DEMO_MODE}" = "true" ] && [ -f "/opt/php-api-stack-templates/index.php" ]; then
187-
log_info "Publishing demo index.php to /var/www/html/public"
188-
mkdir -p /var/www/html/public
189-
cp /opt/php-api-stack-templates/index.php /var/www/html/public/index.php
190-
chown nginx:nginx /var/www/html/public/index.php
191-
chmod 644 /var/www/html/public/index.php
192-
else
193-
rm -f /var/www/html/public/index.php 2>/dev/null || true
194-
fi
195-
196-
# HEALTH_CHECK_INSTALL
197-
if [ "${HEALTH_CHECK_INSTALL}" = "true" ] && [ -f "/opt/php-api-stack-templates/health.php" ]; then
198-
log_info "Publishing health.php to /var/www/html/public"
199-
mkdir -p /var/www/html/public
200-
cp /opt/php-api-stack-templates/health.php /var/www/html/public/health.php
201-
chown nginx:nginx /var/www/html/public/health.php
202-
chmod 644 /var/www/html/public/health.php
203-
else
204-
rm -f /var/www/html/public/health.php 2>/dev/null || true
205-
fi
206-
207183
# -----------------------------------------------------------------------------
208184
# XDEBUG
209185
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)