Skip to content

Commit 7b6eae3

Browse files
authored
Merge pull request #1081 from scott/docker/enhanced
Docker/enhanced
2 parents c5eb5d5 + dbf5960 commit 7b6eae3

14 files changed

+327
-35
lines changed

Dockerfile

+23-17
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,49 @@
11
FROM ruby:2.4
22

3-
ENV HELPY_VERSION=master \
4-
RAILS_ENV=production \
3+
ENV RAILS_ENV=production \
54
HELPY_HOME=/helpy \
65
HELPY_USER=helpyuser \
7-
HELPY_SLACK_INTEGRATION_ENABLED=true
6+
HELPY_SLACK_INTEGRATION_ENABLED=true \
7+
BUNDLE_PATH=/opt/helpy-bundle
88

99
RUN apt-get update \
1010
&& apt-get upgrade -y \
1111
&& apt-get install -y nodejs postgresql-client imagemagick --no-install-recommends \
12-
&& rm -rf /var/lib/apt/lists/* \
13-
&& useradd --no-create-home $HELPY_USER \
14-
&& mkdir -p $HELPY_HOME \
15-
&& chown -R $HELPY_USER:$HELPY_USER $HELPY_HOME /usr/local/lib/ruby /usr/local/bundle
12+
&& apt-get clean \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
RUN useradd --no-create-home $HELPY_USER \
16+
&& mkdir -p $HELPY_HOME $BUNDLE_PATH \
17+
&& chown -R $HELPY_USER:$HELPY_USER $HELPY_HOME $BUNDLE_PATH
1618

1719
WORKDIR $HELPY_HOME
1820

21+
COPY Gemfile Gemfile.lock $HELPY_HOME/
22+
COPY vendor $HELPY_HOME/vendor
23+
RUN chown -R $HELPY_USER $HELPY_HOME
24+
1925
USER $HELPY_USER
2026

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

2328
# add the slack integration gem to the Gemfile if the HELPY_SLACK_INTEGRATION_ENABLED is true
2429
# use `test` for sh compatibility, also use only one `=`. also for sh compatibility
25-
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
30+
RUN test "$HELPY_SLACK_INTEGRATION_ENABLED" = "true" \
31+
&& sed -i '128i\gem "helpy_slack", git: "https://github.com/helpyio/helpy_slack.git", branch: "master"' $HELPY_HOME/Gemfile
2632

2733
RUN bundle install
2834

29-
RUN touch /helpy/log/production.log && chmod 0664 /helpy/log/production.log
30-
31-
# Due to a weird issue with one of the gems, execute this permissions change:
32-
RUN chmod +r /usr/local/bundle/gems/griddler-mandrill-1.1.4/lib/griddler/mandrill/adapter.rb
33-
3435
# manually create the /helpy/public/assets folder and give the helpy user rights to it
3536
# this ensures that helpy can write precompiled assets to it
36-
RUN mkdir -p $HELPY_HOME/public/assets && chown $HELPY_USER $HELPY_HOME/public/assets
37+
RUN mkdir -p $HELPY_HOME/public/assets \
38+
&& chown $HELPY_USER $HELPY_HOME/public/assets
3739

3840
VOLUME $HELPY_HOME/public
3941

42+
USER root
43+
COPY . $HELPY_HOME/
44+
RUN chown -R $HELPY_USER $HELPY_HOME
45+
USER $HELPY_USER
46+
4047
COPY docker/database.yml $HELPY_HOME/config/database.yml
41-
COPY docker/run.sh $HELPY_HOME/run.sh
4248

43-
CMD ["./run.sh"]
49+
CMD ["/bin/bash", "/helpy/docker/run.sh"]

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ gem 'cloudinary', '1.1.7'
9696
gem 'attachinary'
9797

9898
gem 'carrierwave', '~> 1.3.1'
99+
gem 'fog'
100+
gem 'fog-aws'
99101
gem "jquery-fileupload-rails"
100102
gem 'mini_magick'
101103

0 commit comments

Comments
 (0)