Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FROM node:5.4.1
- EXPOSE 3000 35729
- # Install Ruby for sass linting.
- RUN apt-get update && apt-get install ruby -y
- RUN gem update --system && gem install bundler
- # Add a non-root user.
- RUN mkdir -p /home/dockeruser && \
- mkdir -p /var/www/lullabot.com-www && \
- groupadd -r dockeruser -g 433 && \
- useradd -u 431 -r -g dockeruser -d /home/dockeruser -s /sbin/nologin -c "Docker image user" dockeruser && \
- chmod -R 755 /home/dockeruser && \
- chmod -R 755 /var/www/lullabot.com-www
- COPY . /var/www/lullabot.com-www
- # Remove .git so we can differentiate between when code is mounted as a volume or not.
- # If it's present, then when the container starts it will re-run the build process to get new values from the
- # developer's local .env file, otherwise it will run using the values from .env that were initially copied in.
- RUN rm -rf /var/www/lullabot.com-www/.git
- RUN chown -R dockeruser:dockeruser /home/dockeruser && chown -R dockeruser:dockeruser /var/www/lullabot.com-www
- WORKDIR /var/www/lullabot.com-www
- USER dockeruser
- RUN npm run clean && (test -f .env || cp .env.prod .env) && npm run test:install && npm install -q && npm run build
- # Cache the installed dependencies.
- RUN cp -R node_modules /home/dockeruser && \
- cp -R bower_components /home/dockeruser && \
- cp -R vendor /home/dockeruser
- CMD /bin/bash -c 'if [ -d .git ] ; then npm run clean && \
- cp -R /home/dockeruser/node_modules /var/www/lullabot.com-www && \
- cp -R /home/dockeruser/bower_components /var/www/lullabot.com-www && \
- cp -R /home/dockeruser/vendor /var/www/lullabot.com-www && \
- npm run update && (test -f .env || cp .env.prod .env) && npm run build && npm run start; else npm run start ; fi'
- VOLUME /var/www/lullabot.com-www
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement