1
1
FROM ruby:3.1.2
2
2
3
+ ENV GEM_HOME=/opt/bundle
4
+ RUN mkdir -p /opt/bundle /opt/node_modules
3
5
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
4
6
5
7
RUN apt-get -y update && \
@@ -14,8 +16,7 @@ apt-get clean
14
16
15
17
# setup ruby gems
16
18
RUN gem update --system && \
17
- gem install bundler && \
18
- bundle config set --global --without test
19
+ gem install bundler
19
20
20
21
# setup yarn
21
22
RUN npm install -g yarn
@@ -26,20 +27,24 @@ RUN git clone --origin github --branch main --depth 1 https://github.com/hopsoft
26
27
27
28
# install application dependencies 1st time
28
29
WORKDIR /opt/turbo_boost-commands
30
+ RUN ln -s /opt/node_modules /opt/turbo_boost-commands/node_modules
29
31
RUN yarn install --ignore-engines
30
32
RUN bundle
31
33
34
+ # cleanup
35
+ RUN rm -rf /usr/local/share/.cache/* /usr/local/bundle/cache/* /opt/bundle/cache/* /root/.bundle/cache/* /root/.cache/*
36
+
32
37
# prepare the environment
33
38
ENV RAILS_ENV=production RAILS_LOG_TO_STDOUT=true RAILS_SERVE_STATIC_FILES=true
34
39
35
40
# prepare and run the application
36
- CMD git checkout main && \
37
- git pull --no-rebase github main && \
41
+ CMD rm -rf /opt/turbo_boost-commands && \
42
+ git clone --origin github --branch main --depth 1 https://github.com/hopsoft/turbo_boost-commands.git /opt/turbo_boost-commands && \
43
+ cd /opt/turbo_boost-commands/test/dummy && \
44
+ ln -s /opt/node_modules /opt/turbo_boost-commands/node_modules && \
38
45
yarn install --ignore-engines && \
39
- cd test/dummy && \
40
46
bundle && \
41
- rm -f tmp/pids/server.pid && \
47
+ rm -rf tmp/pids/server.pid /usr/local/share/.cache/* /usr/local/bundle/cache/* /opt/bundle/cache/* /root/.bundle/cache/* /root/.cache/* && \
42
48
bin/rails db:create db:migrate && \
43
- bin/rails assets:clobber && \
44
49
bin/rails assets:precompile && \
45
50
bin/rails s --binding=0.0.0.0 --port=3000
0 commit comments