Skip to content

Commit adc0b7f

Browse files
committed
Use Debian Jessie and support Cypress
1 parent 2356fa4 commit adc0b7f

File tree

12 files changed

+81
-170
lines changed

12 files changed

+81
-170
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
name: Push image to Docker Hub
4040
command: |
4141
REPO="digdep/drupal-base"
42-
VERSION_MAJOR="3"
43-
VERSION_MINOR="3"
42+
VERSION_MAJOR="4"
43+
VERSION_MINOR="0"
4444
TAG_PREFIX=$([ "$CIRCLE_BRANCH" = "master" ] && echo || echo "${CIRCLE_BRANCH}-")
4545
TAG_LATEST="$REPO:${TAG_PREFIX}latest"
4646
TAG_MAJOR="$REPO:${TAG_PREFIX}${VERSION_MAJOR}"

Dockerfile

Lines changed: 58 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,84 @@
1-
FROM alpine:3.7
1+
# Based on buildpack-deps:jessie (as of Dec 2017).
2+
FROM node:8
23

3-
ENV NGINX_VERSION 1.12.2
4-
ENV PHP_VERSION 7.1.12
4+
ENV NGINX_GPGKEY 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
5+
ENV SURY_PHP_GPGKEY DF3D585DB8F0EB658690A554AC0E47584A7A714D
56

67
WORKDIR /root
78

8-
# Install runtime dependencies.
9-
RUN apk add --no-cache \
10-
# NGINX runtime dependencies.
11-
pcre \
12-
zlib \
13-
openssl \
14-
# PHP runtime dependencies.
15-
pcre \
16-
zlib \
17-
openssl \
18-
libcurl \
19-
libedit \
20-
libxml2 \
21-
libjpeg-turbo \
22-
libpng \
23-
libzip
24-
25-
# Build stuff.
26-
RUN apk add --no-cache --virtual .build-deps \
9+
RUN apt-get update \
10+
&& apt-get install -y lsb-release ca-certificates apt-transport-https \
11+
&& apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys $NGINX_GPGKEY $SURY_PHP_GPGKEY \
12+
&& echo deb http://nginx.org/packages/debian/ $(lsb_release -sc) nginx >> /etc/apt/sources.list \
13+
&& echo deb https://packages.sury.org/php/ $(lsb_release -sc) main >> /etc/apt/sources.list \
14+
&& apt-get update \
15+
&& apt-get install --no-install-suggests --no-install-recommends -y \
16+
# Human dependencies.
17+
less \
2718
curl \
28-
build-base \
29-
# NGINX build dependencies.
30-
pcre-dev \
31-
zlib-dev \
32-
openssl-dev \
33-
# PHP build dependencies.
34-
autoconf \
35-
pcre-dev \
36-
curl-dev \
37-
libedit-dev \
38-
libxml2-dev \
39-
openssl-dev \
40-
libjpeg-turbo-dev \
41-
libpng-dev \
42-
libzip-dev \
43-
# Build NGINX.
44-
&& curl -fL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | tar -xz \
45-
&& cd nginx-$NGINX_VERSION \
46-
&& ./configure \
47-
--prefix=/etc/nginx \
48-
--sbin-path=/usr/sbin/nginx \
49-
--modules-path=/usr/lib/nginx/modules \
50-
--conf-path=/etc/nginx/nginx.conf \
51-
--error-log-path=/var/log/nginx/error.log \
52-
--http-log-path=/var/log/nginx/access.log \
53-
--pid-path=/var/run/nginx.pid \
54-
--lock-path=/var/run/nginx.lock \
55-
--http-client-body-temp-path=/var/cache/nginx/client_temp \
56-
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
57-
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
58-
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
59-
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
60-
--with-http_ssl_module \
61-
&& make \
62-
&& make install \
63-
&& cd .. \
64-
&& rm -rf nginx-$NGINX_VERSION \
65-
# Build PHP.
66-
&& curl -fL https://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror | tar -xj \
67-
&& cd php-$PHP_VERSION \
68-
&& ./configure \
69-
--prefix=/usr \
70-
--sysconfdir=/etc \
71-
--with-config-file-path=/etc/php \
72-
--with-config-file-scan-dir=/etc/php/conf.d \
73-
--disable-cgi \
74-
--enable-phpdbg=no \
75-
--enable-fpm \
76-
--enable-opcache \
77-
--enable-mbstring \
78-
--with-mysqli \
79-
--with-pdo-mysql \
80-
--enable-exif \
81-
--with-pcre-regex=/usr \
82-
--with-zlib \
83-
--with-openssl \
84-
--with-curl \
85-
--with-libedit \
86-
--with-gd \
87-
--with-jpeg-dir=/usr \
88-
--with-png-dir=/usr \
89-
--enable-zip \
90-
&& make \
91-
&& make install \
92-
&& cd .. \
93-
&& rm -rf php-$PHP_VERSION \
94-
# Build PHP extensions.
95-
&& pecl install xdebug \
96-
# Clean up.
97-
&& apk del .build-deps
98-
99-
RUN apk add --no-cache \
10019
vim \
101-
curl \
102-
supervisor \
103-
# JavaScript workflow dependencies.
104-
nodejs \
105-
nodejs-npm \
106-
yarn \
107-
# Drush runtime dependencies.
20+
# Drush dependencies.
10821
mysql-client \
109-
# CircleCI dependencies.
22+
# CircleCI dependencies.
11023
git \
11124
openssh-client \
112-
tar \
25+
tar \
11326
gzip \
114-
ca-certificates
27+
ca-certificates \
28+
# Cypress dependencies.
29+
libgtk2.0-0 \
30+
libnotify-dev \
31+
libgconf-2-4 \
32+
libnss3 \
33+
libxss1 \
34+
libasound2 \
35+
xvfb \
36+
libxtst6 \
37+
# Web server packages.
38+
supervisor \
39+
nginx \
40+
php7.1-fpm \
41+
php7.1-cli \
42+
php7.1-curl \
43+
php7.1-json \
44+
php7.1-gd \
45+
php7.1-mbstring \
46+
php7.1-mysql \
47+
php7.1-opcache \
48+
php7.1-readline \
49+
php7.1-sqlite3 \
50+
php7.1-xml \
51+
php7.1-zip \
52+
# TODO: Install Xdebug?
53+
&& rm -rf /var/lib/apt/lists/* \
54+
&& apt-get purge -y --auto-remove
11555

11656
RUN curl -fL https://getcomposer.org/installer | php -- \
11757
--install-dir=/usr/local/bin \
11858
--filename=composer
59+
RUN composer global require --no-plugins --no-scripts \
60+
drush/drush \
61+
pantheon-systems/terminus
11962

120-
RUN adduser -D drupal
121-
122-
RUN su drupal -c 'composer global require drush/drush'
123-
RUN su drupal -c 'composer global require pantheon-systems/terminus'
124-
125-
COPY root/etc/supervisord.conf /etc/
63+
COPY supervisord.conf /etc/supervisor/supervisord.conf
12664

127-
RUN mkdir -p /var/cache/nginx \
128-
&& mkdir -p /var/log/nginx \
129-
&& chown drupal:drupal /var/cache/nginx /var/log/nginx \
130-
&& ln -sf /dev/stdout /var/log/nginx/access.log \
65+
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
13166
&& ln -sf /dev/stderr /var/log/nginx/error.log
132-
COPY root/etc/nginx/nginx.conf /etc/nginx/
67+
COPY nginx.conf /etc/nginx/nginx.conf
13368

134-
COPY root/etc/php/conf.d/*.ini /etc/php/conf.d/
135-
COPY root/etc/php-fpm.conf /etc/
69+
COPY php-fpm.conf /etc/php/7.1/fpm/php-fpm.conf
13670

13771
RUN mkdir -p /projects/drupal/web
138-
COPY root/projects/drupal/web/index.php /projects/drupal/web
139-
RUN chown -R drupal:drupal /projects
72+
COPY index.php /projects/drupal/web/index.php
14073

141-
RUN mkdir -p /home/drupal/.drush
142-
COPY root/home/drupal/.drush/drushrc.php /home/drupal/.drush/
143-
RUN chown -R drupal:drupal /home/drupal/.drush
74+
RUN mkdir -p /root/.drush
75+
COPY drushrc.php /root/.drush
14476

145-
COPY root/home/drupal/.my.cnf /home/drupal/
146-
RUN chown -R drupal:drupal /home/drupal/.my.cnf
77+
COPY dotmy.cnf /root/.my.cnf
14778

148-
USER drupal
149-
ENV PATH="/home/drupal/.composer/vendor/bin:${PATH}"
150-
ENV SIMPLETEST_BASE_URL="http://localhost:8080/"
79+
ENV PATH "/root/.composer/vendor/bin:${PATH}"
80+
ENV SIMPLETEST_BASE_URL http://localhost:8080/
15181
WORKDIR /projects
15282

15383
EXPOSE 8080
154-
CMD ["supervisord", "-n", "-c", "/etc/supervisord.conf"]
84+
CMD ["supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
[Docker Hub](https://hub.docker.com/r/digdep/drupal-base/)
66

7-
This is a base image for running Drupal 8 in development. It does not come with Drupal itself, but it does come with a properly configured NGINX, PHP-FPM, Composer, and Drush, and the dependencies required for using it as an image on the CircleCI 2.0 platform.
7+
This is a base image for running Drupal 8 in development. It does not come with Drupal itself, but it does come with a properly configured NGINX (stable), PHP-FPM (7.1), Composer, Drush, Terminus, dependencies for Cypress, and dependencies for CircleCI 2.0.
88

99
See `docker-compose.example.yml` for how to use.
File renamed without changes.
File renamed without changes.
File renamed without changes.

root/etc/nginx/nginx.conf renamed to nginx.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
user www-data;
2+
13
events {
24
# The events block is required, but may be empty.
35
}
@@ -102,7 +104,7 @@ http {
102104
# PHP 7 socket location.
103105
#fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
104106
#fastcgi_pass localhost:9000;
105-
fastcgi_pass unix:/tmp/php-fpm.sock;
107+
fastcgi_pass unix:/var/run/php7.1-fpm.sock;
106108
}
107109

108110
# Fighting with Styles? This little gem is amazing.

root/etc/php-fpm.conf renamed to php-fpm.conf

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
[global]
2+
pid = /var/run/php7.1-fpm.pid
23
error_log = /dev/stderr
34

45
[www]
5-
listen = /tmp/php-fpm.sock
6+
user = www-data
7+
group = www-data
8+
listen = /var/run/php7.1-fpm.sock
9+
listen.owner = www-data
10+
listen.group = www-data
611

712
pm = dynamic
813
pm.max_children = 20
@@ -15,3 +20,9 @@ env[SMTPHOST] = $SMTPHOST
1520

1621
; Ensure worker stdout and stderr are sent to the main error log.
1722
catch_workers_output = yes
23+
24+
; Don't duplicate errors via SAPI into NGINX's logs.
25+
php_flag[fastcgi.logging] = no
26+
27+
; For Drupal.
28+
php_value[memory_limit] = 256M

root/etc/php/conf.d/drupal.ini

Lines changed: 0 additions & 12 deletions
This file was deleted.

root/etc/php/conf.d/opcache.ini

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)