-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from buggregator/feature/improve-docker-image
Improve docker image
- Loading branch information
Showing
1 changed file
with
34 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,42 @@ | ||
FROM php:8.2.13-cli-alpine3.18 | ||
|
||
RUN apk add --no-cache $PHPIZE_DEPS \ | ||
curl \ | ||
libcurl \ | ||
wget \ | ||
libzip-dev \ | ||
libmcrypt-dev \ | ||
libxslt-dev \ | ||
libxml2-dev \ | ||
openssl-dev \ | ||
icu-dev \ | ||
zip \ | ||
unzip \ | ||
linux-headers | ||
|
||
RUN docker-php-ext-install \ | ||
opcache \ | ||
zip \ | ||
xsl \ | ||
dom \ | ||
exif \ | ||
intl \ | ||
pcntl \ | ||
bcmath \ | ||
sockets | ||
FROM php:8.3-cli-alpine3.21 | ||
|
||
ENV TZ="UTC" | ||
ENV COMPOSER_ALLOW_SUPERUSER=1 | ||
|
||
COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/install-php-extensions | ||
COPY --from=composer:2.8.4 /usr/bin/composer /usr/bin/composer | ||
|
||
RUN apk update && apk add --no-cache \ | ||
bash \ | ||
ca-certificates \ | ||
icu-data-full icu-libs \ | ||
libgpg-error libgcrypt libxslt \ | ||
libzip \ | ||
linux-headers \ | ||
lz4-libs \ | ||
openssh-client \ | ||
${PHPIZE_DEPS} \ | ||
&& install-php-extensions pgsql \ | ||
&& install-php-extensions pdo_pgsql \ | ||
&& install-php-extensions pdo_mysql \ | ||
&& install-php-extensions intl \ | ||
&& install-php-extensions zip \ | ||
&& install-php-extensions opcache \ | ||
&& install-php-extensions exif \ | ||
&& install-php-extensions bcmath \ | ||
&& install-php-extensions xsl \ | ||
&& install-php-extensions pcntl \ | ||
&& install-php-extensions sockets \ | ||
&& apk del --no-cache ${PHPIZE_DEPS} \ | ||
&& rm -rf /tmp/* | ||
|
||
# PHP settings | ||
RUN sed -i 's/memory_limit = 128M/memory_limit = 1024M/g' "$PHP_INI_DIR/php.ini-production" && \ | ||
sed -i 's/post_max_size = 8M/post_max_size = 1024M/g' "$PHP_INI_DIR/php.ini-production" && \ | ||
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" | ||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ | ||
&& echo "memory_limit=2048M" >> "$PHP_INI_DIR/conf.d/docker-php.ini" | ||
&& echo "post_max_size=1024M" >> "$PHP_INI_DIR/conf.d/docker-php.ini" | ||
|
||
# Nginx | ||
RUN apk add --no-cache nginx | ||
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf | ||
RUN [ -d /etc/nginx/conf.d ] || mkdir /etc/nginx/conf.d | ||
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf | ||
|
||
# PDO database drivers support | ||
RUN apk --no-cache add postgresql-dev | ||
RUN docker-php-ext-install \ | ||
pgsql pdo_pgsql pdo_mysql | ||
|
||
# MongoDB support | ||
RUN pecl install mongodb \ | ||
&& docker-php-ext-enable mongodb | ||
|
||
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer | ||
|
||
RUN docker-php-source delete \ | ||
&& apk del ${BUILD_DEPENDS} |