Skip to content

Instantly share code, notes, and snippets.

@andrewmclagan
Created October 12, 2016 00:15
Show Gist options
  • Save andrewmclagan/e7df6b7954330595aa724b3e26eae8fa to your computer and use it in GitHub Desktop.
Save andrewmclagan/e7df6b7954330595aa724b3e26eae8fa to your computer and use it in GitHub Desktop.
Docker layer caching with php composer
# create our app directory
RUN mkdir -p /var/www
# Set it as our working dir
WORKDIR /var/www
# add our composer dependancies
ADD composer.json ./
# install our dependancies without running scripts
# then remove composers cache to save space
RUN composer install --no-scripts --no-autoloader --prefer-dist -vvv \
&& rm -rf /root/.composer/cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment