Skip to content

Commit

Permalink
Merge pull request #1081 from scott/docker/enhanced
Browse files Browse the repository at this point in the history
Docker/enhanced
  • Loading branch information
scott authored Jan 15, 2019
2 parents c5eb5d5 + dbf5960 commit 7b6eae3
Show file tree
Hide file tree
Showing 14 changed files with 327 additions and 35 deletions.
40 changes: 23 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,43 +1,49 @@
FROM ruby:2.4

ENV HELPY_VERSION=master \
RAILS_ENV=production \
ENV RAILS_ENV=production \
HELPY_HOME=/helpy \
HELPY_USER=helpyuser \
HELPY_SLACK_INTEGRATION_ENABLED=true
HELPY_SLACK_INTEGRATION_ENABLED=true \
BUNDLE_PATH=/opt/helpy-bundle

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y nodejs postgresql-client imagemagick --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --no-create-home $HELPY_USER \
&& mkdir -p $HELPY_HOME \
&& chown -R $HELPY_USER:$HELPY_USER $HELPY_HOME /usr/local/lib/ruby /usr/local/bundle
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN useradd --no-create-home $HELPY_USER \
&& mkdir -p $HELPY_HOME $BUNDLE_PATH \
&& chown -R $HELPY_USER:$HELPY_USER $HELPY_HOME $BUNDLE_PATH

WORKDIR $HELPY_HOME

COPY Gemfile Gemfile.lock $HELPY_HOME/
COPY vendor $HELPY_HOME/vendor
RUN chown -R $HELPY_USER $HELPY_HOME

USER $HELPY_USER

RUN git clone --branch $HELPY_VERSION --depth=1 https://github.com/helpyio/helpy.git .

# add the slack integration gem to the Gemfile if the HELPY_SLACK_INTEGRATION_ENABLED is true
# use `test` for sh compatibility, also use only one `=`. also for sh compatibility
RUN test "$HELPY_SLACK_INTEGRATION_ENABLED" = "true" && sed -i '128i\gem "helpy_slack", git: "https://github.com/helpyio/helpy_slack.git", branch: "master"' $HELPY_HOME/Gemfile
RUN test "$HELPY_SLACK_INTEGRATION_ENABLED" = "true" \
&& sed -i '128i\gem "helpy_slack", git: "https://github.com/helpyio/helpy_slack.git", branch: "master"' $HELPY_HOME/Gemfile

RUN bundle install

RUN touch /helpy/log/production.log && chmod 0664 /helpy/log/production.log

# Due to a weird issue with one of the gems, execute this permissions change:
RUN chmod +r /usr/local/bundle/gems/griddler-mandrill-1.1.4/lib/griddler/mandrill/adapter.rb

# manually create the /helpy/public/assets folder and give the helpy user rights to it
# this ensures that helpy can write precompiled assets to it
RUN mkdir -p $HELPY_HOME/public/assets && chown $HELPY_USER $HELPY_HOME/public/assets
RUN mkdir -p $HELPY_HOME/public/assets \
&& chown $HELPY_USER $HELPY_HOME/public/assets

VOLUME $HELPY_HOME/public

USER root
COPY . $HELPY_HOME/
RUN chown -R $HELPY_USER $HELPY_HOME
USER $HELPY_USER

COPY docker/database.yml $HELPY_HOME/config/database.yml
COPY docker/run.sh $HELPY_HOME/run.sh

CMD ["./run.sh"]
CMD ["/bin/bash", "/helpy/docker/run.sh"]
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ gem 'cloudinary', '1.1.7'
gem 'attachinary'

gem 'carrierwave', '~> 1.3.1'
gem 'fog'
gem 'fog-aws'
gem "jquery-fileupload-rails"
gem 'mini_magick'

Expand Down
Loading

0 comments on commit 7b6eae3

Please sign in to comment.