-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (39 loc) · 1.15 KB
/
Dockerfile
File metadata and controls
51 lines (39 loc) · 1.15 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
50
51
FROM php:8.3-cli-alpine
# Install system dependencies
RUN apk add --no-cache \
git \
zip \
unzip \
bash \
curl \
libzip-dev \
linux-headers \
nodejs \
npm \
$PHPIZE_DEPS
# Install PHP extensions
RUN docker-php-ext-install zip pcntl \
&& pecl install xdebug \
&& pecl install ast \
&& docker-php-ext-enable xdebug ast
# Configure Xdebug for coverage
RUN echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# Install Composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /app
# Copy composer files first for better caching
COPY composer.json composer.lock* ./
# Install dependencies
RUN composer install --no-interaction --no-progress --prefer-dist --optimize-autoloader
# Copy package.json and commitlint config
COPY package.json package-lock.json* commitlint.config.js ./
# Install Node dependencies
RUN npm install --no-save
# Copy the rest of the application
COPY . .
# Create a non-root user to run tests
RUN adduser -D -u 1000 testuser && chown -R testuser:testuser /app
USER testuser
# Default command
CMD ["composer", "tests"]