Today I finally had some time to cleaned up my Dockerfile for Magento 2. I am using Alpine Linux for most of my Magento 2 projects which usually includes NGINX, PHP-FPM and MariaDB.
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 |
# Use Alpine Linux FROM alpine:3.7 # Declare maintainer MAINTAINER Tobias Forkel <tobias@forkel.me> # Timezone ENV TIMEZONE Australia/Melbourne RUN addgroup -g 1000 www && \ adduser -S www -G www -s /sbin/nologin -D ADD https://repos.php.earth/alpine/phpearth.rsa.pub /etc/apk/keys/phpearth.rsa.pub RUN echo "https://repos.php.earth/alpine/v3.7" >> /etc/apk/repositories RUN apk --no-cache add \ bash \ git \ openssl \ nginx \ supervisor \ curl \ mariadb \ mariadb-client \ libxml2-utils \ php7.1-common \ php7.1-fpm \ php7.1-json \ .... |
While testing my updated Dockerfile I came across the following PHP notice which prevented the deployment scripts from finishing the Magento 2 setup.
1 |
Notice: Use of undefined constant T_CURLY_OPEN - assumed 'T_CURLY_OPEN' in /var/www/src/setup/src/Magento/Setup/Module/ Di/Code/Reader/FileClassScanner.php on line 72 |
The problem was simply a missing PHP extension php7.1-tokenizer which has resolved the issue after re-creating the container with –build.
1 |
docker-compose up -d --build |