-
Notifications
You must be signed in to change notification settings - Fork 54
/
Dockerfile_dev
executable file
·70 lines (55 loc) · 2.93 KB
/
Dockerfile_dev
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
FROM composer:1.8.6 AS composer
FROM php:7.3.7-fpm
# Let's use bash as a default shell
SHELL ["/bin/bash", "-c"]
# Update package list and install necessary libraries
RUN apt-get update && apt-get install -y \
zlib1g-dev libzip-dev libxml2-dev libicu-dev g++ nano vim git unzip jq bash-completion iproute2 \
&& rm -rf /var/lib/apt/lists/*
# Enable all necessary PHP packages
RUN docker-php-ext-install -j$(nproc) bcmath \
&& docker-php-ext-install pdo \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& docker-php-ext-install opcache \
&& docker-php-ext-install zip \
&& pecl install xdebug-2.7.1 \
&& docker-php-ext-enable xdebug
# Install APCu and APC backward compatibility
RUN pecl install apcu \
&& pecl install apcu_bc-1.0.5 \
&& docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini \
&& docker-php-ext-enable apc --ini-name 20-docker-php-ext-apc.ini
# Copy the Composer PHAR from the Composer image into the PHP image
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Copy use php.ini to container
COPY ./docker/php/php-dev.ini /usr/local/etc/php/php.ini
# Allow use of composer as a root and add composer bin to path
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV PATH "$PATH:/root/.composer/vendor/bin"
# Define used work directory
WORKDIR /app
# Add everything inside docker image
ADD . .
# Install bamarni/symfony-console-autocomplete as a global one to get autocomplete working
RUN composer global require bamarni/symfony-console-autocomplete
RUN echo "xdebug.idekey = PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.default_enable = 0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_enable = 1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_autostart = 1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_connect_back = 0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.profiler_enable = 0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_host = 127.0.0.1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_port = 9009" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
# Ensure that all required files has execute rights
RUN chmod +x /app/bin/console \
&& chmod +x /app/docker-entrypoint-dev.sh \
&& chmod +x /usr/bin/composer
# Allow to use more memory + add necessary stuff to bash autocomplete
RUN echo 'memory_limit = 2048M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini \
&& echo 'expose_php=off' >> /usr/local/etc/php/conf.d/docker-expose-php.ini \
&& echo 'source /usr/share/bash-completion/bash_completion' >> /etc/bash.bashrc \
&& echo 'eval "$(symfony-autocomplete --shell bash)"' >> /etc/bash.bashrc
EXPOSE 9000
ENTRYPOINT ["/app/docker-entrypoint-dev.sh"]