|
1 | 1 | FROM ruby:2.4
|
2 | 2 |
|
3 |
| -ENV HELPY_VERSION=master \ |
4 |
| - RAILS_ENV=production \ |
| 3 | +ENV RAILS_ENV=production \ |
5 | 4 | HELPY_HOME=/helpy \
|
6 | 5 | HELPY_USER=helpyuser \
|
7 |
| - HELPY_SLACK_INTEGRATION_ENABLED=true |
| 6 | + HELPY_SLACK_INTEGRATION_ENABLED=true \ |
| 7 | + BUNDLE_PATH=/opt/helpy-bundle |
8 | 8 |
|
9 | 9 | RUN apt-get update \
|
10 | 10 | && apt-get upgrade -y \
|
11 | 11 | && 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 |
16 | 18 |
|
17 | 19 | WORKDIR $HELPY_HOME
|
18 | 20 |
|
| 21 | +COPY Gemfile Gemfile.lock $HELPY_HOME/ |
| 22 | +COPY vendor $HELPY_HOME/vendor |
| 23 | +RUN chown -R $HELPY_USER $HELPY_HOME |
| 24 | + |
19 | 25 | USER $HELPY_USER
|
20 | 26 |
|
21 |
| -RUN git clone --branch $HELPY_VERSION --depth=1 https://github.com/helpyio/helpy.git . |
22 | 27 |
|
23 | 28 | # add the slack integration gem to the Gemfile if the HELPY_SLACK_INTEGRATION_ENABLED is true
|
24 | 29 | # 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 |
26 | 32 |
|
27 | 33 | RUN bundle install
|
28 | 34 |
|
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 |
| - |
34 | 35 | # manually create the /helpy/public/assets folder and give the helpy user rights to it
|
35 | 36 | # 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 |
37 | 39 |
|
38 | 40 | VOLUME $HELPY_HOME/public
|
39 | 41 |
|
| 42 | +USER root |
| 43 | +COPY . $HELPY_HOME/ |
| 44 | +RUN chown -R $HELPY_USER $HELPY_HOME |
| 45 | +USER $HELPY_USER |
| 46 | + |
40 | 47 | COPY docker/database.yml $HELPY_HOME/config/database.yml
|
41 |
| -COPY docker/run.sh $HELPY_HOME/run.sh |
42 | 48 |
|
43 |
| -CMD ["./run.sh"] |
| 49 | +CMD ["/bin/bash", "/helpy/docker/run.sh"] |
0 commit comments