Skip to content

Commit da067b9

Browse files
Andreas Frömericanhazstring
authored andcommitted
Add docker support
1 parent 059aab6 commit da067b9

File tree

5 files changed

+89
-0
lines changed

5 files changed

+89
-0
lines changed

.docker/php7.3/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM php:7.3-alpine
2+
3+
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
4+
5+
COPY --from=composer:2.0.0-RC2 /usr/bin/composer /usr/bin/composer
6+
ENV COMPOSER_ALLOW_SUPERUSER 1
7+
8+
WORKDIR /docker
9+
# Workaround to keep container running
10+
CMD ["tail", "-f", "/dev/null"]

.docker/php7.4/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM php:7.4-alpine
2+
3+
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
4+
5+
COPY --from=composer:2.0.0-RC2 /usr/bin/composer /usr/bin/composer
6+
ENV COMPOSER_ALLOW_SUPERUSER 1
7+
8+
WORKDIR /docker
9+
# Workaround to keep container running
10+
CMD ["tail", "-f", "/dev/null"]

.docker/php8.0/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM php:8.0.0RC2-alpine
2+
3+
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
4+
5+
COPY --from=composer:2.0.0-RC2 /usr/bin/composer /usr/bin/composer
6+
ENV COMPOSER_ALLOW_SUPERUSER 1
7+
8+
WORKDIR /docker
9+
# Workaround to keep container running
10+
CMD ["tail", "-f", "/dev/null"]

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
CONTAINER=systemctl-php-7.4
2+
3+
up:
4+
docker-compose up -d
5+
6+
down:
7+
docker-compose down
8+
9+
install:
10+
docker exec -it $(CONTAINER) composer install
11+
12+
update:
13+
docker exec -it $(CONTAINER) composer update
14+
15+
require:
16+
docker exec -it $(CONTAINER) composer require $(filter-out $@, $(MAKECMDGOALS))
17+
18+
remove:
19+
docker exec -it $(CONTAINER) composer remove $(filter-out $@, $(MAKECMDGOALS))
20+
21+
check: csfix cs phpunit analyse
22+
23+
phpunit:
24+
docker exec -it $(CONTAINER) vendor/bin/phpunit
25+
26+
analyse:
27+
docker exec -it $(CONTAINER) vendor/bin/phpstan analyse
28+
29+
cs:
30+
docker exec -it $(CONTAINER) vendor/bin/phpcs
31+
32+
csfix:
33+
docker exec -it $(CONTAINER) vendor/bin/phpcbf
34+
35+
%:
36+
@true

docker-compose.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: "3.7"
2+
3+
services:
4+
php7.3:
5+
build: .docker/php7.3
6+
container_name: systemctl-php-7.3
7+
volumes:
8+
- .:/docker:rw
9+
tty: true
10+
11+
php7.4:
12+
build: .docker/php7.4
13+
container_name: systemctl-php-7.4
14+
volumes:
15+
- .:/docker:rw
16+
tty: true
17+
18+
php8.0:
19+
build: .docker/php8.0
20+
container_name: systemctl-php-8.0
21+
volumes:
22+
- .:/docker:rw
23+
tty: true

0 commit comments

Comments
 (0)