Siapkan deploy Docker/Coolify
- Dockerfile php:8.3-apache, document root public/ - Entrypoint menyiapkan folder unggahan (volume persisten) - Percayai header proxy (Traefik/Cloudflare) - Keluarkan file sesi, cache, dan view terkompilasi dari repo Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
FROM php:8.3-apache
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends libpng-dev libjpeg62-turbo-dev libfreetype6-dev libzip-dev unzip \
|
||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& docker-php-ext-install pdo_mysql gd zip bcmath exif opcache \
|
||||
&& a2enmod rewrite headers \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
|
||||
RUN sed -ri 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
|
||||
&& sed -ri 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf \
|
||||
&& printf 'upload_max_filesize=20M\npost_max_size=25M\nmemory_limit=256M\nexpose_php=Off\n' > /usr/local/etc/php/conf.d/app.ini
|
||||
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||
|
||||
WORKDIR /var/www/html
|
||||
COPY composer.json composer.lock ./
|
||||
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --no-interaction
|
||||
|
||||
COPY . .
|
||||
RUN composer dump-autoload --optimize --no-dev \
|
||||
&& chown -R www-data:www-data storage bootstrap/cache public
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
CMD ["apache2-foreground"]
|
||||
Reference in New Issue
Block a user