Dockerfile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. FROM ruby:2.2-slim
  2. # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
  3. RUN groupadd -r redmine && useradd -r -g redmine redmine
  4. # grab gosu for easy step-down from root
  5. ENV GOSU_VERSION 1.7
  6. RUN set -x \
  7. && curl -fSL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
  8. && curl -fSL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
  9. && export GNUPGHOME="$(mktemp -d)" \
  10. && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
  11. && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
  12. && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
  13. && chmod +x /usr/local/bin/gosu \
  14. && gosu nobody true
  15. # grab tini for signal processing and zombie killing
  16. ENV TINI_VERSION v0.9.0
  17. RUN set -x \
  18. && curl -fSL -o /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini" \
  19. && curl -fSL -o /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini.asc" \
  20. && export GNUPGHOME="$(mktemp -d)" \
  21. && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 6380DC428747F6C393FEACA59A84159D7001A4E5 \
  22. && gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini \
  23. && rm -r "$GNUPGHOME" /usr/local/bin/tini.asc \
  24. && chmod +x /usr/local/bin/tini \
  25. && tini -h
  26. RUN apt-get update && apt-get install -y --no-install-recommends \
  27. imagemagick \
  28. libmysqlclient18 \
  29. libpq5 \
  30. libsqlite3-0 \
  31. \
  32. bzr \
  33. git \
  34. mercurial \
  35. openssh-client \
  36. subversion \
  37. && rm -rf /var/lib/apt/lists/*
  38. ENV RAILS_ENV production
  39. WORKDIR /usr/src/redmine
  40. ENV REDMINE_VERSION 3.2.1
  41. ENV REDMINE_DOWNLOAD_MD5 425aa0c56b66bf48c878798a9f7c6546
  42. RUN curl -fSL "http://www.redmine.org/releases/redmine-${REDMINE_VERSION}.tar.gz" -o redmine.tar.gz \
  43. && echo "$REDMINE_DOWNLOAD_MD5 redmine.tar.gz" | md5sum -c - \
  44. && tar -xvf redmine.tar.gz --strip-components=1 \
  45. && rm redmine.tar.gz files/delete.me log/delete.me \
  46. && mkdir -p tmp/pdf public/plugin_assets \
  47. && chown -R redmine:redmine ./
  48. RUN buildDeps='\
  49. gcc \
  50. libmagickcore-dev \
  51. libmagickwand-dev \
  52. libmysqlclient-dev \
  53. libpq-dev \
  54. libsqlite3-dev \
  55. make \
  56. patch \
  57. ' \
  58. && set -ex \
  59. && apt-get update && apt-get install -y $buildDeps --no-install-recommends \
  60. && rm -rf /var/lib/apt/lists/* \
  61. && bundle install --without development test \
  62. && for adapter in mysql2 postgresql sqlite3; do \
  63. echo "$RAILS_ENV:" > ./config/database.yml; \
  64. echo " adapter: $adapter" >> ./config/database.yml; \
  65. bundle install --without development test; \
  66. done \
  67. && rm ./config/database.yml \
  68. && apt-get purge -y --auto-remove $buildDeps
  69. VOLUME ["/usr/src/redmine/files", "/usr/src/redmine/plugins"]
  70. RUN mkdir /usr/src/redmine/public/themes/circle
  71. COPY circle /usr/src/redmine/public/themes/circle/
  72. RUN chown -R redmine:redmine /usr/src/redmine/public/themes/circle
  73. RUN chmod -R 775 /usr/src/redmine/public/themes/circle
  74. COPY docker-entrypoint.sh /
  75. ENTRYPOINT ["/docker-entrypoint.sh"]
  76. EXPOSE 3000
  77. CMD ["rails", "server", "-b", "0.0.0.0"]