-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfileLiveReload
More file actions
59 lines (47 loc) · 1.3 KB
/
DockerfileLiveReload
File metadata and controls
59 lines (47 loc) · 1.3 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
52
53
54
55
56
57
58
59
# Use the official PHP image with FPM and Alpine
FROM php:7.4-fpm-alpine
# Install system dependencies
RUN apk add --no-cache \
libressl-dev \
pkgconfig \
nodejs \
npm \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libxml2-dev \
libzip-dev \
nginx \
wget \
$PHPIZE_DEPS \
&& docker-php-ext-configure gd --with-jpeg --with-freetype \
&& docker-php-ext-install gd pdo pdo_mysql zip
RUN apk add --no-cache nginx wget \
${PHPIZE_DEPS} \
&& pecl install mongodb-1.17.2 \
&& docker-php-ext-enable \
mongodb \
&& apk del \
${PHPIZE_DEPS}
# Install Composer
RUN wget https://getcomposer.org/composer.phar && \
chmod +x composer.phar && \
mv composer.phar /usr/local/bin/composer
# Install entr for live reloading
RUN apk add --no-cache entr
# Set working directory
WORKDIR /var/www
# Copy application files
COPY . /var/www
# Install Node.js dependencies
RUN npm install -g npm@9.6.5
RUN npm install
RUN npm run dev
# Install PHP dependencies
RUN composer install --no-dev
# Change ownership of application files
RUN chown -R www-data:www-data /var/www
# Expose port 8000
EXPOSE 8000
# Command to run the application with live reloading
CMD sh -c "cd /var/www && find . -name '*.php' | entr -r -n php artisan serve --host=0.0.0.0 --port=8000"