-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.Dockerfile
More file actions
49 lines (44 loc) · 1.73 KB
/
test.Dockerfile
File metadata and controls
49 lines (44 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# syntax=docker/dockerfile:1.6.0
# The above line freezes dockerfile frontend syntax/features being available when using buildkit: https://hub.docker.com/r/docker/dockerfile
# Specifies the composer image used to install PHP dependencies
ARG COMPOSER_VERSION=2.7.6
# Specifies the PHP image used to execute tests
ARG PHP_VERSION=8.1.31-cli-alpine3.21
############
# composer #
############
# Builder stage to specify the composer version to install PHP dependencies
# - turns "composer" image into an alias pointing to our desired image
FROM composer:$COMPOSER_VERSION AS composer
##############
# PHP - base #
##############
FROM php:$PHP_VERSION AS base
LABEL authors="Sebastian Krein"
# Specifies the build directory where we want to develop/test
# Provide composer to install dependencies directly within the app container
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
RUN apk add --no-cache git linux-headers $PHPIZE_DEPS \
&& pecl install xdebug-3.4.4 \
&& docker-php-ext-enable xdebug
RUN mv $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini
ARG XDEBUG_CLIENT_HOST
ARG WORKING_DIR
COPY <<XDEBUG_INI /usr/local/etc/php/conf.d/99-xdebug.ini
xdebug.client_host=$XDEBUG_CLIENT_HOST
xdebug.output_dir=$WORKING_DIR/xdebug
xdebug.log=$WORKING_DIR/xdebug/xdebug.log
xdebug.mode=\${ENV_XDEBUG_MODE}
XDEBUG_INI
ENV ENV_XDEBUG_MODE='off'
ENTRYPOINT ["/usr/local/bin/docker-php-entrypoint"]
# Runs a shell by default
CMD ["/bin/sh"]
WORKDIR $WORKING_DIR
# If image is used standalone (no bind mount), this is required to avoid xdebug complaing about none existing folder
RUN mkdir xdebug
###################################
# PHP - used to run phpunit tests #
###################################
FROM base AS tester
LABEL authors="Sebastian Krein"