I have the following Dockerfile
FROM wordpress #make sure necessary tools for publishing are installed RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - && \ apt-get install -y nodejs git && \ npm install -g npm gulp bower ADD . /var/www/html/wp-content/themes/new-theme RUN cd /var/www/html/wp-content/themes/new-theme \ && npm install \ && npm run build \ && rm -rf node_modules \ && rm -rf bower_components \ && find ./* -type f -printf "%h%f\n" | sort \ && cd / VOLUME ["/var/www/html/wp-content/themes/new-theme"] ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"]
When I build it, the second RUN command produces several files that get dropped into the
/var/www/html/wp-content/themes/ca-ticket.com/dist folder, and when I view the build log I can see clearly that the files are getting created (that is why the
find ./* -type f -printf "%h%f\n" | sort is there.
From the log:
build 11-Apr-2016 18:51:01 ./dist/scriptsjquery.js build 11-Apr-2016 18:51:01 ./dist/scriptsjquery.js.map build 11-Apr-2016 18:51:01 ./dist/scriptsmain.js build 11-Apr-2016 18:51:01 ./dist/scriptsmain.js.map build 11-Apr-2016 18:51:01 ./dist/stylesmain.css build 11-Apr-2016 18:51:01 ./dist/stylesmain.css.map
… and so on.
However, when I create a container from this image, the
/var/www/html/wp-content/themes/ca-ticket.com/dist simply doesn’t exist!
The build command is:
docker build --force-rm=true --tag="<tag here>" /path/to/context
I’ve also tried with the
--no-cache option with no change to the result.
I’m running the image with:
docker run --name <name> -d -p 81:80 -e WORDPRESS_DB_HOST=<dbhost> -e WORDPRESS_DB_USER=<dbuser> -e WORDPRESS_DB_PASSWORD=<pass> -e WORDPRESS_DB_NAME=<dbname> -e WORDPRESS_TABLE_PREFIX=<tblprefix> <imagename>
I’m suspect I must be doing something silly to cause docker to ignore a layer, but I’m not sure what is wrong about this process.