-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
147 lines (123 loc) · 4.29 KB
/
Copy pathDockerfile
File metadata and controls
147 lines (123 loc) · 4.29 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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Pull base image.
FROM php:8.1-fpm
# Some definitions
LABEL php-version="8.1"
LABEL description="Production PHP-FPM image"
LABEL company="Actency"
LABEL author="Hakim Rachidi"
COPY config/php.ini /usr/local/etc/php/
RUN apt-get clean && apt-get update && apt-get install --fix-missing wget apt-transport-https lsb-release ca-certificates gnupg2 -y
RUN echo "deb http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
RUN echo "deb-src http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
RUN cd /tmp && wget https://www.dotdeb.org/dotdeb.gpg && apt-key add dotdeb.gpg
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true
RUN apt-get clean && apt-get update && apt-cache search php-mysql && apt-get install --fix-missing -y \
ruby-dev \
rubygems \
graphviz \
sudo \
libmemcached-tools \
libmemcached-dev \
libpng-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libxml2-dev \
libxslt1-dev \
mariadb-client \
linux-libc-dev \
libyaml-dev \
zlib1g-dev \
libicu-dev \
libpq-dev \
bash-completion \
htop \
libldap2-dev \
libssl-dev \
libonig-dev \
npm \
libzip-dev \
git \
&& rm -rf /var/lib/apt/lists/*
# Install others php modules
RUN docker-php-ext-configure gd --with-jpeg=/usr/include/
RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/
RUN docker-php-ext-install \
gd \
mbstring \
zip \
soap \
pdo_mysql \
mysqli \
opcache \
calendar \
intl \
exif \
ftp \
bcmath \
ldap
# Install YAML extension
RUN pecl install yaml-2.2.2 && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/ext-yaml.ini
# Install APCu extension - NO LONGER SUPPORTED IN PHP8 !
# RUN pecl install apcu-5.1.18
# Installation of APCu cache
# RUN ( \
# echo "extension=apcu.so"; \
# echo "apc.enabled=1"; \
# ) > /usr/local/etc/php/conf.d/ext-apcu.ini
# Installation ex
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
apt-get update && apt-get install -y nodejs && \
npm install npm@latest -g
# Installation of Composer
RUN cd /usr/src && curl -sS http://getcomposer.org/installer | php
RUN cd /usr/src && mv composer.phar /usr/bin/composer
# Installation of drush 11
RUN git clone https://github.com/drush-ops/drush.git /usr/local/src/drush
RUN cp -r /usr/local/src/drush/ /usr/local/src/drush11/
RUN cd /usr/local/src/drush11 && git checkout 11.1.0
RUN cd /usr/local/src/drush11 && composer update && composer install
RUN ln -s /usr/local/src/drush11/drush /usr/bin/drush11
# install msmtp
RUN set -x \
&& DEBIAN_FRONTEND=noninteractive \
&& apt-get update && apt-get install -y --no-install-recommends msmtp && rm -r /var/lib/apt/lists/*
ADD core/msmtprc.conf /usr/local/etc/msmtprc
ADD core/php-smtp.ini /usr/local/etc/php/conf.d/php-smtp.ini
# Installation of Opcode cache
RUN ( \
echo "opcache.memory_consumption=128"; \
echo "opcache.interned_strings_buffer=8"; \
echo "opcache.max_accelerated_files=20000"; \
echo "opcache.revalidate_freq=5"; \
echo "opcache.fast_shutdown=1"; \
echo "opcache.enable_cli=1"; \
) > /usr/local/etc/php/conf.d/opcache-recommended.ini
# Create new web user for apache and grant sudo without password
RUN useradd web -d /var/www -g www-data -s /bin/bash
RUN usermod -aG sudo web
RUN echo 'web ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Add sudo to www-data
RUN echo 'www-data ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# create directory for ssh keys
RUN mkdir /var/www/.ssh/
RUN chown -R www-data:www-data /var/www/
RUN chmod -R 600 /var/www/.ssh/
# Set timezone to Europe/Paris
RUN echo "Europe/Paris" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
# Add web .bashrc config
COPY config/bashrc /var/www/
RUN mv /var/www/bashrc /var/www/.bashrc
RUN chown www-data:www-data /var/www/.bashrc
RUN echo "source .bashrc" >> /var/www/.profile ;\
chown www-data:www-data /var/www/.profile
# Connect as web by default
RUN echo 'su web' >> /root/.bashrc
# Set and run a custom entrypoint
COPY core/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-entrypoint
VOLUME /var/www/html
ENTRYPOINT ["docker-php-entrypoint"]
EXPOSE 9000
CMD ["php-fpm"]