-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
50 lines (39 loc) · 1.67 KB
/
Dockerfile.dev
File metadata and controls
50 lines (39 loc) · 1.67 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
# Use an official PHP runtime as a parent image
FROM php:7.4-apache
# Set the working directory inside the container
WORKDIR /var/www/html
# Install needed dependencies and PHP extensions
RUN apt-get update && apt-get install -y \
git \
zip \
unzip \
vim \
curl \
&& pecl install xdebug \
&& docker-php-ext-install mysqli \
&& a2enmod rewrite \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js and npm
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Copy the current directory contents into the container
COPY . /var/www/html
# Install npm packages (including Tailwind CSS)
RUN npm install
# Copy the development PHP config file
COPY php.ini /usr/local/etc/php/php.ini
# Configure Xdebug for remote debugging in development
RUN echo "xdebug.mode=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.client_port=9003" >> /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
# Ensure development PHP settings (error display, etc.)
RUN echo "display_errors=On" >> /usr/local/etc/php/conf.d/docker-php-dev.ini \
&& echo "error_reporting=E_ALL" >> /usr/local/etc/php/conf.d/docker-php-dev.ini
# Set permissions (optional based on project needs)
RUN chown -R www-data:www-data /var/www/html
# Healthcheck
HEALTHCHECK CMD curl --fail http://localhost/ || exit 1
# By default, start Apache in foreground mode
CMD ["apache2-foreground"]