Skip to content

Commit c36b3d3

Browse files
author
Felipe Almeida Baccaro
committed
Initializing with php-alpine images, cli and fpm modes and builds for development and production.
0 parents  commit c36b3d3

11 files changed

Lines changed: 261 additions & 0 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

‎8.3-alpine/cli/Dockerfile‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FROM php:8.3-cli-alpine as Base
2+
3+
RUN apk update && apk upgrade --no-cache \
4+
&& apk add icu libzip libxml2 zip bzip2 libgd libpng libjpeg-turbo libwebp tiff freetype libpq libxslt \
5+
&& apk add --no-cache --virtual build-deps $PHPIZE_DEPS \
6+
g++ \
7+
autoconf \
8+
make \
9+
icu-dev \
10+
libzip-dev \
11+
libxml2-dev \
12+
zip \
13+
bzip2-dev \
14+
libgd \
15+
libpng-dev \
16+
libjpeg-turbo-dev \
17+
libwebp-dev \
18+
tiff-dev \
19+
freetype-dev \
20+
libpq-dev \
21+
libxslt-dev \
22+
&& apk add --update --no-cache linux-headers \
23+
&& pecl install ds redis \
24+
&& docker-php-ext-enable xdebug ds redis \
25+
&& docker-php-ext-configure intl \
26+
&& docker-php-ext-configure zip \
27+
&& docker-php-ext-configure pgsql --with-pgsql=/usr/local/pgsql \
28+
&& docker-php-ext-configure bz2 \
29+
&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include/ \
30+
&& docker-php-ext-install -j$(nproc) gd \
31+
&& docker-php-ext-install intl bz2 exif zip bcmath mysqli pgsql pdo pdo_pgsql pdo_mysql soap sockets xsl \
32+
&& apk del -f build-deps \
33+
34+
USER www-data
35+
36+
RUN chmod 0775 /var/www/html
37+
38+
WORKDIR /var/www/html
39+
40+
FROM Base as Dev
41+
42+
RUN pecl install xdebug
43+
44+
COPY etc/php-ext-xdebug.ini /usr/local/etc/php/conf.d/php-ext-xdebug.ini
45+
46+
COPY composer-installater.sh /composer-installation.sh
47+
48+
RUN chmod +x tool/composer-installation.sh && /composer-installation.sh && rm /composer-installation.sh
49+
50+
CMD ["composer", "self-update", "clear-cache"]
51+
52+
FROM Base as Prod
53+
54+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
4+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
5+
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
6+
7+
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
8+
then
9+
>&2 echo 'ERROR: Invalid installer checksum'
10+
rm composer-setup.php
11+
exit 1
12+
fi
13+
14+
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
15+
RESULT=$?
16+
rm composer-setup.php
17+
exit $RESULT
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
xdebug.mode=develop,coverage,debug,profile
2+
xdebug.client_host=host.docker.internal
3+
xdebug.log=/dev/stdout
4+
xdebug.start_with_request=yes
5+
xdebug.client_port=9003
6+
xdebug.log_level=0

‎8.3-alpine/fpm/Dockerfile‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM php:8.3-fpm-alpine as Base
2+
3+
RUN apk update && apk upgrade --no-cache \
4+
&& apk add icu libzip libxml2 zip bzip2 libgd libpng libjpeg-turbo libwebp tiff freetype libpq libxslt \
5+
&& apk add --no-cache --virtual build-deps $PHPIZE_DEPS \
6+
g++ \
7+
autoconf \
8+
make \
9+
icu-dev \
10+
libzip-dev \
11+
libxml2-dev \
12+
zip \
13+
bzip2-dev \
14+
libgd \
15+
libpng-dev \
16+
libjpeg-turbo-dev \
17+
libwebp-dev \
18+
tiff-dev \
19+
freetype-dev \
20+
libpq-dev \
21+
libxslt-dev \
22+
&& apk add --update --no-cache linux-headers \
23+
&& pecl install ds redis \
24+
&& docker-php-ext-enable xdebug ds redis \
25+
&& docker-php-ext-configure intl \
26+
&& docker-php-ext-configure zip \
27+
&& docker-php-ext-configure pgsql --with-pgsql=/usr/local/pgsql \
28+
&& docker-php-ext-configure bz2 \
29+
&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include/ \
30+
&& docker-php-ext-install -j$(nproc) gd \
31+
&& docker-php-ext-install intl bz2 exif zip bcmath mysqli pgsql pdo pdo_pgsql pdo_mysql soap sockets xsl \
32+
&& apk del -f build-deps \
33+
34+
WORKDIR /var/www/html
35+
36+
FROM Base as Dev
37+
38+
RUN pecl install xdebug
39+
40+
COPY etc/php-ext-xdebug.ini /usr/local/etc/php/conf.d/php-ext-xdebug.ini
41+
42+
COPY composer-installater.sh /composer-installation.sh
43+
44+
RUN chmod +x tool/composer-installation.sh && /composer-installation.sh && rm /composer-installation.sh
45+
46+
CMD ["composer", "self-update", "clear-cache"]
47+
48+
FROM Base as Prod
49+
50+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
xdebug.mode=develop,coverage,debug,profile
2+
xdebug.client_host=host.docker.internal
3+
xdebug.log=/dev/stdout
4+
xdebug.start_with_request=yes
5+
xdebug.client_port=9003
6+
xdebug.log_level=0

‎8.4-alpine/cli/Dockerfile‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM php:8.4-cli-alpine as Base
2+
3+
RUN apk update && apk upgrade --no-cache \
4+
&& apk add icu libzip libxml2 zip bzip2 libgd libpng libjpeg-turbo libwebp tiff freetype libpq libxslt \
5+
&& apk add --no-cache --virtual build-deps $PHPIZE_DEPS \
6+
g++ \
7+
autoconf \
8+
make \
9+
icu-dev \
10+
libzip-dev \
11+
libxml2-dev \
12+
zip \
13+
bzip2-dev \
14+
libgd \
15+
libpng-dev \
16+
libjpeg-turbo-dev \
17+
libwebp-dev \
18+
tiff-dev \
19+
freetype-dev \
20+
libpq-dev \
21+
libxslt-dev \
22+
&& apk add --update --no-cache linux-headers \
23+
&& pecl install ds redis \
24+
&& docker-php-ext-enable xdebug ds redis \
25+
&& docker-php-ext-configure intl \
26+
&& docker-php-ext-configure zip \
27+
&& docker-php-ext-configure pgsql --with-pgsql=/usr/local/pgsql \
28+
&& docker-php-ext-configure bz2 \
29+
&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include/ \
30+
&& docker-php-ext-install -j$(nproc) gd \
31+
&& docker-php-ext-install intl bz2 exif zip bcmath mysqli pgsql pdo pdo_pgsql pdo_mysql soap sockets xsl \
32+
&& apk del -f build-deps \
33+
34+
WORKDIR /var/www/html
35+
36+
FROM Base as Dev
37+
38+
RUN pecl install xdebug
39+
40+
COPY etc/php-ext-xdebug.ini /usr/local/etc/php/conf.d/php-ext-xdebug.ini
41+
42+
COPY composer-installater.sh /composer-installation.sh
43+
44+
RUN chmod +x tool/composer-installation.sh && /composer-installation.sh && rm /composer-installation.sh
45+
46+
CMD ["composer", "self-update", "clear-cache"]
47+
48+
FROM Base as Prod
49+
50+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
4+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
5+
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
6+
7+
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
8+
then
9+
>&2 echo 'ERROR: Invalid installer checksum'
10+
rm composer-setup.php
11+
exit 1
12+
fi
13+
14+
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
15+
RESULT=$?
16+
rm composer-setup.php
17+
exit $RESULT
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
xdebug.mode=develop,coverage,debug,profile
2+
xdebug.client_host=host.docker.internal
3+
xdebug.log=/dev/stdout
4+
xdebug.start_with_request=yes
5+
xdebug.client_port=9003
6+
xdebug.log_level=0

‎8.4-alpine/fpm/Dockerfile‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM php:8.4-fpm-alpine as Base
2+
3+
RUN apk update && apk upgrade --no-cache \
4+
&& apk add icu libzip libxml2 zip bzip2 libgd libpng libjpeg-turbo libwebp tiff freetype libpq libxslt \
5+
&& apk add --no-cache --virtual build-deps $PHPIZE_DEPS \
6+
g++ \
7+
autoconf \
8+
make \
9+
icu-dev \
10+
libzip-dev \
11+
libxml2-dev \
12+
zip \
13+
bzip2-dev \
14+
libgd \
15+
libpng-dev \
16+
libjpeg-turbo-dev \
17+
libwebp-dev \
18+
tiff-dev \
19+
freetype-dev \
20+
libpq-dev \
21+
libxslt-dev \
22+
&& apk add --update --no-cache linux-headers \
23+
&& pecl install ds redis \
24+
&& docker-php-ext-enable xdebug ds redis \
25+
&& docker-php-ext-configure intl \
26+
&& docker-php-ext-configure zip \
27+
&& docker-php-ext-configure pgsql --with-pgsql=/usr/local/pgsql \
28+
&& docker-php-ext-configure bz2 \
29+
&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include/ \
30+
&& docker-php-ext-install -j$(nproc) gd \
31+
&& docker-php-ext-install intl bz2 exif zip bcmath mysqli pgsql pdo pdo_pgsql pdo_mysql soap sockets xsl \
32+
&& apk del -f build-deps \
33+
34+
WORKDIR /var/www/html
35+
36+
FROM Base as Dev
37+
38+
RUN pecl install xdebug
39+
40+
COPY etc/php-ext-xdebug.ini /usr/local/etc/php/conf.d/php-ext-xdebug.ini
41+
42+
COPY composer-installater.sh /composer-installation.sh
43+
44+
RUN chmod +x tool/composer-installation.sh && /composer-installation.sh && rm /composer-installation.sh
45+
46+
CMD ["composer", "self-update", "clear-cache"]
47+
48+
FROM Base as Prod
49+
50+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

0 commit comments

Comments
 (0)