Skip to content

Commit 487c3c1

Browse files
authored
Merge pull request #2 from buggregator/feature/improve-docker-image
Improve docker image
2 parents f929e47 + 7ddf035 commit 487c3c1

File tree

1 file changed

+34
-43
lines changed

1 file changed

+34
-43
lines changed

Dockerfile

Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,42 @@
1-
FROM php:8.2.13-cli-alpine3.18
2-
3-
RUN apk add --no-cache $PHPIZE_DEPS \
4-
curl \
5-
libcurl \
6-
wget \
7-
libzip-dev \
8-
libmcrypt-dev \
9-
libxslt-dev \
10-
libxml2-dev \
11-
openssl-dev \
12-
icu-dev \
13-
zip \
14-
unzip \
15-
linux-headers
16-
17-
RUN docker-php-ext-install \
18-
opcache \
19-
zip \
20-
xsl \
21-
dom \
22-
exif \
23-
intl \
24-
pcntl \
25-
bcmath \
26-
sockets
1+
FROM php:8.3-cli-alpine3.21
2+
3+
ENV TZ="UTC"
4+
ENV COMPOSER_ALLOW_SUPERUSER=1
5+
6+
COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/install-php-extensions
7+
COPY --from=composer:2.8.4 /usr/bin/composer /usr/bin/composer
8+
9+
RUN apk update && apk add --no-cache \
10+
bash \
11+
ca-certificates \
12+
icu-data-full icu-libs \
13+
libgpg-error libgcrypt libxslt \
14+
libzip \
15+
linux-headers \
16+
lz4-libs \
17+
openssh-client \
18+
${PHPIZE_DEPS} \
19+
&& install-php-extensions pgsql \
20+
&& install-php-extensions pdo_pgsql \
21+
&& install-php-extensions pdo_mysql \
22+
&& install-php-extensions intl \
23+
&& install-php-extensions zip \
24+
&& install-php-extensions opcache \
25+
&& install-php-extensions exif \
26+
&& install-php-extensions bcmath \
27+
&& install-php-extensions xsl \
28+
&& install-php-extensions pcntl \
29+
&& install-php-extensions sockets \
30+
&& apk del --no-cache ${PHPIZE_DEPS} \
31+
&& rm -rf /tmp/*
2732

2833
# PHP settings
29-
RUN sed -i 's/memory_limit = 128M/memory_limit = 1024M/g' "$PHP_INI_DIR/php.ini-production" && \
30-
sed -i 's/post_max_size = 8M/post_max_size = 1024M/g' "$PHP_INI_DIR/php.ini-production" && \
31-
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
34+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
35+
&& echo "memory_limit=2048M" >> "$PHP_INI_DIR/conf.d/docker-php.ini"
36+
&& echo "post_max_size=1024M" >> "$PHP_INI_DIR/conf.d/docker-php.ini"
3237

3338
# Nginx
3439
RUN apk add --no-cache nginx
3540
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
3641
RUN [ -d /etc/nginx/conf.d ] || mkdir /etc/nginx/conf.d
3742
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
38-
39-
# PDO database drivers support
40-
RUN apk --no-cache add postgresql-dev
41-
RUN docker-php-ext-install \
42-
pgsql pdo_pgsql pdo_mysql
43-
44-
# MongoDB support
45-
RUN pecl install mongodb \
46-
&& docker-php-ext-enable mongodb
47-
48-
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
49-
50-
RUN docker-php-source delete \
51-
&& apk del ${BUILD_DEPENDS}

0 commit comments

Comments
 (0)