Dockerfile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. FROM ruby:2.3-slim
  2. RUN mkdir /opt/actioncenter
  3. WORKDIR /opt/actioncenter
  4. RUN apt-get update && \
  5. apt-get install -y --no-install-recommends \
  6. curl \
  7. build-essential \
  8. git \
  9. libpq-dev \
  10. libfontconfig \
  11. postgresql-client \
  12. cron \
  13. gnupg
  14. RUN set -x; \
  15. curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh \
  16. && chmod +x nodesource_setup.sh \
  17. && ./nodesource_setup.sh \
  18. && apt-get update \
  19. && apt-get install -y --no-install-recommends \
  20. nodejs \
  21. && apt-get clean \
  22. && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  23. RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
  24. && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
  25. && apt-get update \
  26. && apt-get install \
  27. yarn
  28. # Create a symlink to what will be the phantomjs exec path
  29. RUN ln -s /phantomjs-2.1.1-linux-x86_64/bin/phantomjs /bin/phantomjs
  30. # Set up phantomjs, making sure to check the known good sha256sum
  31. RUN cd / && curl -sLo phantomjs.tar.bz2 https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
  32. bash -l -c '[ "`sha256sum phantomjs.tar.bz2 | cut -f1 -d" "`" = "86dd9a4bf4aee45f1a84c9f61cf1947c1d6dce9b9e8d2a907105da7852460d2f" ]' && \
  33. tar -jxvf phantomjs.tar.bz2 > /dev/null && \
  34. rm phantomjs.tar.bz2
  35. COPY yarn.lock package.json ./
  36. RUN yarn install
  37. ADD Gemfile* ./
  38. RUN bundle install
  39. ADD bin/ ./bin
  40. ADD config/ ./config
  41. ADD config.ru ./
  42. ADD Rakefile ./
  43. ADD db/ ./db
  44. ADD lib/ ./lib
  45. ADD public/ ./public
  46. ADD app/ ./app
  47. ADD features/ ./features
  48. ADD script/ ./script
  49. ADD spec/ ./spec
  50. ADD vendor/ ./vendor
  51. ADD docker/ ./docker
  52. ADD .rubocop.yml ./.rubocop.yml
  53. ADD .sass-lint.yml ./.sass-lint.yml
  54. RUN usermod -u 1000 www-data
  55. COPY docker/crontab /etc/cron.d/crontab
  56. RUN chmod 0644 /etc/cron.d/crontab
  57. RUN bundle exec rake assets:precompile \
  58. RAILS_ENV=production \
  59. SECRET_KEY_BASE=noop \
  60. devise_secret_key=noop \
  61. DATABASE_URL=postgres://noop
  62. RUN bundle exec rake webshims:update_public
  63. RUN mkdir /opt/actioncenter/log \
  64. /var/www
  65. RUN chown -R www-data /opt/actioncenter/public \
  66. /opt/actioncenter/db \
  67. /opt/actioncenter/tmp \
  68. /opt/actioncenter/log \
  69. /var/www
  70. USER www-data
  71. CMD ["rails", "s", "-b", "0.0.0.0"]
  72. ENTRYPOINT ["/opt/actioncenter/docker/entrypoint.sh"]