Skip to content

Commit 4df28eb

Browse files
committed
ADD docker
1 parent f45e11f commit 4df28eb

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

Dockerfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
ARG PHP_VERSION
2+
FROM php:${PHP_VERSION}cli
3+
4+
# Increase memory limit
5+
RUN echo 'memory_limit = -1' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini
6+
7+
# install Composer
8+
COPY ./docker/composer.sh /root/
9+
10+
RUN <<EOF
11+
set -eux;
12+
apt-get update;
13+
apt-get install -y \
14+
git \
15+
zip;
16+
rm -rf /var/lib/apt/lists/*;
17+
cd /root/;
18+
chmod 755 composer.sh;
19+
/root/composer.sh;
20+
mv /root/composer.phar /usr/local/bin/composer;
21+
rm /root/composer.sh;
22+
EOF
23+
24+
# install Xdebug
25+
ARG XDEBUG_ENABLED=1
26+
27+
RUN <<EOF
28+
if [ $XDEBUG_ENABLED -eq 1 ]; then
29+
pecl install xdebug;
30+
docker-php-ext-enable xdebug;
31+
fi
32+
EOF
33+
34+
WORKDIR /app/

docker-compose.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
services:
2+
latest:
3+
build:
4+
args:
5+
PHP_VERSION: ""
6+
tty: true
7+
volumes:
8+
- .:/app/
9+
php80:
10+
build:
11+
args:
12+
PHP_VERSION: "8.0-"
13+
extends:
14+
service: latest
15+
php81:
16+
build:
17+
args:
18+
PHP_VERSION: "8.1-"
19+
extends:
20+
service: latest
21+
php82:
22+
build:
23+
args:
24+
PHP_VERSION: "8.2-"
25+
extends:
26+
service: latest
27+
php83:
28+
build:
29+
args:
30+
PHP_VERSION: "8.3-"
31+
extends:
32+
service: latest
33+
php84:
34+
build:
35+
args:
36+
PHP_VERSION: "8.4-rc-"
37+
XDEBUG_ENABLED: 0
38+
extends:
39+
service: latest

docker/composer.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
# copied from https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
4+
5+
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
6+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
7+
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
8+
9+
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
10+
then
11+
>&2 echo 'ERROR: Invalid installer checksum'
12+
rm composer-setup.php
13+
exit 1
14+
fi
15+
16+
php composer-setup.php --quiet
17+
RESULT=$?
18+
rm composer-setup.php
19+
exit $RESULT

0 commit comments

Comments
 (0)