Skip to content

Commit 90cc568

Browse files
committed
add docker-compose to simplify running tests
1 parent d6c36a0 commit 90cc568

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

.env-example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
COMPOSER_HOME=~/.config/composer
2+
UID=1000

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
tests/_support
66
tests/_output
77
tests/cases/yii2-app-advanced/_data/db.sqlite
8+
.env

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ARG PHP_VERSION="8.3-alpine"
2+
3+
FROM php:$PHP_VERSION
4+
5+
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
6+
7+
RUN chmod +x /usr/local/bin/install-php-extensions \
8+
&& apk add --no-cache git \
9+
&& install-php-extensions gd intl zip intl pcov @composer
10+
11+
WORKDIR /var/www/html

docker-compose.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
services:
2+
3+
php80: &phpbase
4+
user: ${UID}
5+
volumes:
6+
- ${COMPOSER_HOME}:/.config/composer:delegated
7+
# Mount source-code for development
8+
- ./:/var/www/html
9+
env_file:
10+
- .env
11+
environment:
12+
- XDEBUG_CONFIG=client_host=host.docker.internal
13+
extra_hosts:
14+
- "host.docker.internal:host-gateway"
15+
build:
16+
context: ./
17+
dockerfile: Dockerfile
18+
args:
19+
- PHP_VERSION=8.0-alpine
20+
21+
php81:
22+
<<: *phpbase
23+
build:
24+
args:
25+
- PHP_VERSION=8.1-alpine
26+
php82:
27+
<<: *phpbase
28+
build:
29+
args:
30+
- PHP_VERSION=8.2-alpine
31+
32+
php83:
33+
<<: *phpbase
34+
build:
35+
args:
36+
- PHP_VERSION=8.3-alpine
37+
php84:
38+
<<: *phpbase
39+
build:
40+
args:
41+
- PHP_VERSION=8.4-alpine

0 commit comments

Comments
 (0)