-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (36 loc) · 1.29 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (36 loc) · 1.29 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
FROM php:8.1-cli-alpine
# Install system dependencies
RUN apk add --no-cache \
git \
unzip \
libzip-dev \
autoconf \
g++ \
make \
linux-headers
# Install PHP extensions
RUN docker-php-ext-install zip pcntl
# Install Xdebug
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Configure Xdebug
RUN echo "xdebug.mode=debug,develop" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.discover_client_host=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# Set working directory
WORKDIR /app
# Copy composer files for better caching
COPY composer.json composer.lock* ./
# Install dependencies
RUN composer install --no-scripts --no-autoloader
# Copy project files
COPY . .
# Finish composer setup
RUN composer dump-autoload --optimize
# Expose port for PHP built-in server (examples)
EXPOSE 8000
CMD ["php", "-S", "0.0.0.0:8000", "-t", "examples"]