forked from vertuoza/php-gql-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
72 lines (45 loc) · 1.45 KB
/
Dockerfile
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
60
61
62
63
64
65
66
67
68
69
70
71
72
# keep something similar to kevin
FROM php:8.2-fpm as base
WORKDIR /var/www/html
COPY ./src /var/www/html/src
COPY ./composer.json /var/www/html/composer.json
COPY ./index.php /var/www/html/index.php
COPY ./assets /var/www/html/assets
RUN ls .
# Install dependencies
RUN apt-get update \
&& apt-get install -y \
zip \
unzip
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN apt-get install -y \
libmagickwand-dev --no-install-recommends
RUN pecl install imagick \
&& docker-php-ext-enable imagick
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN composer install
RUN composer dump-autoload
################## Development image ##################
FROM base as development
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
# Should be put in the mutlistage dockerfile as dev base.
COPY ./debug/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
COPY ./debug/error_reporting.ini /usr/local/etc/php/conf.d/error_reporting.ini
# Install nodemon to watch php server
RUN apt-get update \
&& apt-get install -y \
nodejs \
npm
RUN npm install -g nodemon
EXPOSE 9000
EXPOSE 80
# hot reloading enabled
CMD ["php", "./index.php"]
################## Production image ##################
FROM base as production
RUN rm -rf /var/www/html/tests
RUN rm -rf /var/www/html/src/**/*.spec
EXPOSE 80
CMD ["php", "./index.php"]