- video_api.php: check function_exists('imagecreatefromstring') before calling GD
— undefined function causes PHP fatal error even with @ suppressor, kills php-fpm
- Dockerfile: add zlib-dev (required for libpng on some Alpine versions)
- Dockerfile: verify GD loaded after install (build log confirmation)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
45 lines
1.9 KiB
Docker
45 lines
1.9 KiB
Docker
# ── Stage 1: build frontend ───────────────────────────────────────────────────
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /build
|
|
COPY frontend/package*.json ./
|
|
RUN npm ci --quiet
|
|
COPY frontend/ ./
|
|
COPY frontend/.env.optical .env.production
|
|
RUN npm run build
|
|
|
|
# ── Stage 2: runtime (nginx + php-fpm) ────────────────────────────────────────
|
|
FROM php:8.2-fpm-alpine
|
|
RUN apk add --no-cache nginx supervisor libpng-dev libjpeg-turbo-dev zlib-dev \
|
|
&& docker-php-ext-configure gd --with-jpeg \
|
|
&& docker-php-ext-install -j$(nproc) gd \
|
|
&& php -m | grep -i gd && echo "GD installed OK" || echo "GD missing — resize disabled"
|
|
|
|
# Composer
|
|
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
|
|
|
# Backend PHP files + deps
|
|
WORKDIR /var/www/html/lux-studio/api
|
|
COPY backend/*.php ./
|
|
COPY backend/composer.json ./
|
|
RUN composer install --no-dev --optimize-autoloader --no-interaction --no-security-blocking
|
|
|
|
# Built frontend
|
|
COPY --from=builder /build/dist /var/www/html/lux-studio
|
|
|
|
# nginx + supervisord config
|
|
COPY docker/nginx.conf /etc/nginx/nginx.conf
|
|
COPY docker/supervisord.conf /etc/supervisord.conf
|
|
|
|
# uploads dir (overridden by named volume at runtime)
|
|
RUN mkdir -p /var/www/html/lux-studio/api/uploads/sessions \
|
|
/var/www/html/lux-studio/api/generated_videos \
|
|
&& chown -R www-data:www-data /var/www/html/lux-studio \
|
|
&& chmod -R 777 /var/www/html/lux-studio/api/uploads \
|
|
&& chmod -R 777 /var/www/html/lux-studio/api/generated_videos
|
|
|
|
# PHP limits for large image uploads (ini_set can't override these at runtime)
|
|
RUN printf "post_max_size = 100M\nupload_max_filesize = 100M\nmemory_limit = 512M\n" \
|
|
> /usr/local/etc/php/conf.d/uploads.ini
|
|
|
|
EXPOSE 80
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|