File size: 1,550 Bytes
2df0cf9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# PHP {{ config.phpVersion or '8.3' }} Dockerfile with Apache
FROM php:{{ config.phpVersion or '8.3' }}-apache

WORKDIR /var/www/html

# Install system dependencies
RUN apt-get update && apt-get install -y \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    zip \
    unzip \
    git \
    && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg && \
    docker-php-ext-install -j$(nproc) \
    gd \
    pdo \
    pdo_mysql \
    mysqli \
    opcache

{% if config.composer %}
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Copy composer files
COPY composer.json composer.lock* ./

# Install dependencies
{% if config.developmentMode %}
RUN composer install --no-interaction
{% else %}
RUN composer install --no-dev --no-interaction --optimize-autoloader
{% endif %}
{% endif %}

# Copy application code
COPY . .

# Set permissions
RUN chown -R www-data:www-data /var/www/html && \
    chmod -R 755 /var/www/html

{% if not config.developmentMode %}
# Enable Apache rewrite module
RUN a2enmod rewrite

# Configure Apache for production
RUN echo "ServerTokens Prod" >> /etc/apache2/apache2.conf && \
    echo "ServerSignature Off" >> /etc/apache2/apache2.conf
{% endif %}

# Expose port
EXPOSE {{ config.port or '80' }}

{% if config.developmentMode %}
# Development mode
ENV ENVIRONMENT=development

CMD ["apache2-foreground"]
{% else %}
# Production mode
ENV ENVIRONMENT=production

# Start Apache
CMD ["apache2-foreground"]
{% endif %}