+57
-31
@@ -1,38 +1,64 @@
|
||||
FROM php:8.2-apache
|
||||
FROM php:8.3-apache
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install \
|
||||
g++ \
|
||||
libcurl4-gnutls-dev \
|
||||
libxml2-dev \
|
||||
libxslt-dev \
|
||||
libzip-dev \
|
||||
zlib1g-dev \
|
||||
msmtp \
|
||||
unzip \
|
||||
git \
|
||||
locales \
|
||||
--no-install-recommends \
|
||||
&& docker-php-ext-install pdo pdo_mysql mysqli xsl xml zip opcache \
|
||||
&& a2enmod rewrite proxy proxy_http headers \
|
||||
&& apt-get purge -y g++ \
|
||||
&& apt-get autoremove -y \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
libicu-dev \
|
||||
libzip-dev \
|
||||
libonig-dev \
|
||||
libssh2-1 \
|
||||
libssh2-1-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Get latest Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
RUN pecl install ssh2 \
|
||||
&& docker-php-ext-enable ssh2 \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-install \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
mysqli \
|
||||
intl \
|
||||
ftp \
|
||||
mbstring \
|
||||
bcmath \
|
||||
zip
|
||||
|
||||
# Update the default apache site with the config we created.
|
||||
ADD docker/apache.conf /etc/apache2/sites-enabled/000-default.conf
|
||||
RUN a2enmod rewrite
|
||||
|
||||
WORKDIR /var/www/html
|
||||
COPY . /var/www/html
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
|
||||
|
||||
WORKDIR /var/www/app
|
||||
RUN mkdir -p storage/framework/{sessions,views,cache,cache/data} && \
|
||||
chown -R www-data:www-data storage/framework && \
|
||||
chmod -R 775 storage
|
||||
|
||||
#RUN php artisan cache:clear && \
|
||||
# php artisan config:clear && \
|
||||
# php artisan view:clear
|
||||
ENV APACHE_DOCUMENT_ROOT=/var/www/app/public
|
||||
|
||||
RUN sed -ri \
|
||||
-e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' \
|
||||
/etc/apache2/sites-available/*.conf \
|
||||
/etc/apache2/apache2.conf \
|
||||
/etc/apache2/conf-available/*.conf
|
||||
|
||||
RUN echo '<Directory /var/www/app/public>\n\
|
||||
AllowOverride All\n\
|
||||
Require all granted\n\
|
||||
</Directory>' > /etc/apache2/conf-available/laravel.conf \
|
||||
&& a2enconf laravel
|
||||
|
||||
COPY composer.json composer.lock ./
|
||||
|
||||
# Note: for Laravel, the COPY . . needs to be before the composer install
|
||||
COPY . .
|
||||
|
||||
RUN composer install \
|
||||
--no-dev \
|
||||
--prefer-dist \
|
||||
--no-interaction \
|
||||
--optimize-autoloader
|
||||
|
||||
RUN mkdir -p \
|
||||
storage/framework/cache/data \
|
||||
storage/framework/sessions \
|
||||
storage/framework/views \
|
||||
&& chown -R www-data:www-data storage bootstrap/cache \
|
||||
&& chmod -R ug+rwx storage bootstrap/cache
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
Reference in New Issue
Block a user