-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
85 lines (65 loc) · 3.38 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
73
74
75
76
77
78
79
80
81
82
83
84
85
FROM php:8.2-apache AS deploy
#TODO Focus this dockerfile on deploying the applicatio to docker hub
# PHP_CPPFLAGS are used by the docker-php-ext-* scripts, which in turn are required
# in order to build the intl extension.
ENV PHP_CPPFLAGS="$PHP_CPPFLAGS"
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install memcached wait-for-it libicu-dev git zip unzip libgd3 zlib1g-dev libwebp-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libfreetype6-dev -y
RUN pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-configure gd --with-webp --with-jpeg --with-xpm --with-freetype \
&& docker-php-ext-install mysqli pdo pdo_mysql gd \
&& docker-php-ext-install opcache \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl
RUN a2enmod rewrite
RUN service apache2 restart
# Set a custom document root from the Web server
ARG APACHE_DOCUMENT_ROOT="/var/www/phpauth/"
ARG APP_ROOT="/var/www/phpauth/"
WORKDIR ${APP_ROOT}
RUN sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/sites-available/*.conf
RUN sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Copy utilities that the application can use to be more consistent during
# bootstrap.
COPY dev/docker/web/docker-php-entrypoint /usr/local/bin/
# Copy the entire application into the container
COPY composer.* console .htaccess .env.example index.php mix-manifest.json ./
COPY app app
COPY assets assets
COPY bin bin
COPY spitfire spitfire
# Use composer to build all the dependencies into the container. This way it
# can be used standalone and will behave consistently.
RUN composer install --no-interaction --no-autoloader --no-dev
RUN composer dump-autoload --no-interaction --optimize
# Enable the session directory being written to.
# In future revisions I would like to revert back to using the default directory, since
# it makes no sense to have this here.
RUN mkdir -p bin/usr/sessions
RUN mkdir -p bin/usr/uploads
RUN chown -R www-data: bin/usr
#TODO: Make the storage and public storage directories writable.
FROM deploy AS debug
# install xdebug
RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN echo 'xdebug.mode = debug' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_enable = 1' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_autostart = 1' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.client_port=9000' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.start_with_request = yes' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.client_host=host.docker.internal' >> /usr/local/etc/php/php.ini
# Web driver needs libzip dev to work.
RUN apt install libzip-dev -y
RUN docker-php-ext-install zip
FROM debug as integration
COPY dev/docker/web/xdebug/001-xdebug.conf /etc/apache2/sites-enabled/
COPY dev/docker/web/xdebug/ /opt/commishes/xdebug/
RUN sed "s/xdebug.mode = debug/xdebug.mode = coverage/i" -i"" /usr/local/etc/php/php.ini
RUN echo 'opcache.enable=0' >> /usr/local/etc/php/conf.d/xebug-integration.ini
RUN service apache2 restart
RUN echo 'auto_prepend_file=/opt/commishes/xdebug/before.php' >> /usr/local/etc/php/conf.d/xebug-integration.ini
RUN echo 'auto_append_file=/opt/commishes/xdebug/after.php' >> /usr/local/etc/php/conf.d/xebug-integration.ini
RUN mkdir --mode=0777 /var/www/coverage/