Two images instead of the multi-stage build you cannot have yet

Building assets inside the runtime image drags Node, the whole node_modules tree and a compiler toolchain into production — several hundred megabytes to produce one bundle. There is no way to discard a build stage in a single Dockerfile this year.

# Dockerfile.build — has node, never deployed
FROM node:6
COPY . /src
RUN npm install && npm run build

# build, then extract the artefact
# docker build -f Dockerfile.build -t shop-build .
# docker run --rm -v $PWD/dist:/out shop-build cp -r /src/dist/. /out/

# Dockerfile — runtime only
FROM php:7.0-fpm
COPY dist /var/www/public/dist

Two Dockerfiles and a copy step in between, orchestrated by the CI job. It is clumsier than what arrives in 2017 and it produces the same result: a runtime image containing the output and none of the toolchain. Worth setting up as soon as the image passes a few hundred megabytes, because pull time is deploy time.