Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. FROM node:5.4.1
  2. EXPOSE 3000 35729
  3.  
  4. # Install Ruby for sass linting.
  5. RUN apt-get update && apt-get install ruby -y
  6. RUN gem update --system && gem install bundler
  7.  
  8. # Add a non-root user.
  9. RUN mkdir -p /home/dockeruser && \
  10. mkdir -p /var/www/lullabot.com-www && \
  11. groupadd -r dockeruser -g 433 && \
  12. useradd -u 431 -r -g dockeruser -d /home/dockeruser -s /sbin/nologin -c "Docker image user" dockeruser && \
  13. chmod -R 755 /home/dockeruser && \
  14. chmod -R 755 /var/www/lullabot.com-www
  15.  
  16. COPY . /var/www/lullabot.com-www
  17. # Remove .git so we can differentiate between when code is mounted as a volume or not.
  18. # If it's present, then when the container starts it will re-run the build process to get new values from the
  19. # developer's local .env file, otherwise it will run using the values from .env that were initially copied in.
  20. RUN rm -rf /var/www/lullabot.com-www/.git
  21. RUN chown -R dockeruser:dockeruser /home/dockeruser && chown -R dockeruser:dockeruser /var/www/lullabot.com-www
  22. WORKDIR /var/www/lullabot.com-www
  23. USER dockeruser
  24. RUN npm run clean && (test -f .env || cp .env.prod .env) && npm run test:install && npm install -q && npm run build
  25.  
  26. # Cache the installed dependencies.
  27. RUN cp -R node_modules /home/dockeruser && \
  28. cp -R bower_components /home/dockeruser && \
  29. cp -R vendor /home/dockeruser
  30.  
  31. CMD /bin/bash -c 'if [ -d .git ] ; then npm run clean && \
  32. cp -R /home/dockeruser/node_modules /var/www/lullabot.com-www && \
  33. cp -R /home/dockeruser/bower_components /var/www/lullabot.com-www && \
  34. cp -R /home/dockeruser/vendor /var/www/lullabot.com-www && \
  35. npm run update && (test -f .env || cp .env.prod .env) && npm run build && npm run start; else npm run start ; fi'
  36.  
  37. VOLUME /var/www/lullabot.com-www
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement