-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile-build
42 lines (35 loc) · 1.41 KB
/
Dockerfile-build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Generated by dockerfile_splitter
# ghcr.io/kmmndr/yaroute:latest-build
ARG SOURCE_IMAGE_TAG=latest
ARG SOURCE_IMAGE=ghcr.io/kmmndr/yaroute
FROM $SOURCE_IMAGE:${SOURCE_IMAGE_TAG}-ruby
# Install Gems
COPY --chown=app Gemfile Gemfile.lock $APP_PATH/
# Set bundler local config in /app/.bundle folder
RUN bundle config --local jobs 2 \
# Do not allow changes in Gemfile.lock
&& bundle config --local frozen 'true' \
# Install gems in specified path
&& bundle config --local path 'vendor/bundle' \
# Do not install development gems
&& bundle config --local without 'development,test' \
&& bundle install
# Install js dependencies
COPY --chown=app package.json yarn.lock $APP_PATH/
RUN yarn install --check-files
# Copy minimal content for assets precompilation
COPY --chown=app app/api $APP_PATH/app/api
COPY --chown=app app/assets $APP_PATH/app/assets
COPY --chown=app app/javascript $APP_PATH/app/javascript
COPY --chown=app bin $APP_PATH/bin
COPY --chown=app config $APP_PATH/config
COPY --chown=app Rakefile \
$APP_PATH/
RUN bundle exec rake RAILS_ENV=production DATABASE_URL=sqlite3:///:memory: SECRET_KEY_BASE=dummy assets:clean assets:precompile \
&& bundle exec rake RAILS_ENV=production tmp:cache:clear \
&& rm -f vendor/bundle/ruby/*/cache/*.gem \
&& find vendor/bundle/ruby/*/gems/ -name "*.c" -delete \
&& find vendor/bundle/ruby/*/gems/ -name "*.o" -delete
# Copy full application
COPY --chown=app . $APP_PATH
###