-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
37 lines (27 loc) · 1.11 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
FROM php:8.2-alpine
# Install required extensions and tools
RUN apk add --no-cache $PHPIZE_DEPS git zip unzip linux-headers \
&& docker-php-ext-install opcache \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug
# Install watchexec for hot reloading
RUN apk add --no-cache watchexec
# Set working directory
WORKDIR /app
# Install composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy composer files and install dependencies
COPY composer.json composer.lock* ./
RUN composer install --no-scripts --no-autoloader
# Copy the rest of the application
COPY . .
# Generate optimized autoloader
RUN composer dump-autoload --optimize
# Configure PHP for development
RUN echo "xdebug.mode=develop,debug" >> /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
# Expose port
EXPOSE 3010
# Use php development server to run the application
CMD ["php", "-S", "0.0.0.0:3010", "index.php"]