Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG PHP_VERSION
FROM php:${PHP_VERSION}cli

# Increase memory limit
RUN echo 'memory_limit = -1' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini

# install Composer
COPY ./docker/composer.sh /root/

RUN <<EOF
set -eux;
apt-get update;
apt-get install -y \
git \
zip;
rm -rf /var/lib/apt/lists/*;
cd /root/;
chmod 755 composer.sh;
/root/composer.sh;
mv /root/composer.phar /usr/local/bin/composer;
rm /root/composer.sh;
EOF

# install Xdebug
ARG XDEBUG_ENABLED=1

RUN <<EOF
if [ $XDEBUG_ENABLED -eq 1 ]; then
pecl install xdebug;
docker-php-ext-enable xdebug;
fi
EOF

WORKDIR /app/
39 changes: 39 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
services:
latest:
build:
args:
PHP_VERSION: ""
tty: true
volumes:
- .:/app/
php80:
build:
args:
PHP_VERSION: "8.0-"
extends:
service: latest
php81:
build:
args:
PHP_VERSION: "8.1-"
extends:
service: latest
php82:
build:
args:
PHP_VERSION: "8.2-"
extends:
service: latest
php83:
build:
args:
PHP_VERSION: "8.3-"
extends:
service: latest
php84:
build:
args:
PHP_VERSION: "8.4-rc-"
XDEBUG_ENABLED: 0
extends:
service: latest
19 changes: 19 additions & 0 deletions docker/composer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

# copied from https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md

EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
Loading