50 lines
1.2 KiB
Docker
50 lines
1.2 KiB
Docker
# Multi-stage build for smaller final image
|
|
FROM php:8.4-fpm-alpine AS base
|
|
|
|
# Install system dependencies
|
|
RUN apk add --no-cache \
|
|
nginx \
|
|
supervisor \
|
|
curl \
|
|
zip \
|
|
unzip \
|
|
git \
|
|
oniguruma-dev \
|
|
libpng-dev \
|
|
libjpeg-turbo-dev \
|
|
freetype-dev \
|
|
libzip-dev \
|
|
postgresql-dev \
|
|
mysql-client
|
|
|
|
# Install PHP extensions
|
|
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
|
|
&& docker-php-ext-install pdo pdo_mysql pdo_pgsql mbstring exif pcntl bcmath gd zip
|
|
|
|
# Install Composer
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
|
|
# Set working directory
|
|
WORKDIR /var/www/html
|
|
|
|
# Copy config files
|
|
COPY docker/etc/nginx/http.d/default.conf /etc/nginx/http.d/default.conf
|
|
COPY docker/etc/supervisor/conf.d/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
COPY docker/start.sh ./start.sh
|
|
COPY .env.example ./.env
|
|
|
|
# Copy application files
|
|
COPY . .
|
|
|
|
# Install dependencies
|
|
RUN composer install --no-dev --optimize-autoloader
|
|
|
|
# Set permissions
|
|
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache \
|
|
&& chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["./start.sh"]
|