Skip to content

Commit fdfa9d0

Browse files
committed
chore: Refactor Dockerfile for gem installation and precompilation
1 parent 58f1356 commit fdfa9d0

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

Dockerfile

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,23 @@ ENV RAILS_ENV="production" \
1313
BUNDLE_PATH="/usr/local/bundle" \
1414
BUNDLE_WITHOUT="development"
1515

16-
1716
# Throw-away build stage to reduce size of final image
1817
FROM base as build
1918

2019
# Install packages needed to build gems
2120
RUN apt-get update -qq && \
22-
apt-get install --no-install-recommends -y build-essential git libvips pkg-config
21+
apt-get install --no-install-recommends -y build-essential git libvips pkg-config cmake
2322

2423
# Install application gems
2524
COPY Gemfile Gemfile.lock ./
26-
RUN bundle install && \
27-
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
28-
bundle exec bootsnap precompile --gemfile
25+
RUN bundle install
2926

3027
# Copy application code
3128
COPY . .
3229

3330
# Precompile bootsnap code for faster boot times
3431
RUN bundle exec bootsnap precompile app/ lib/
3532

36-
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
37-
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
38-
39-
4033
# Final stage for app image
4134
FROM base
4235

@@ -59,4 +52,4 @@ ENTRYPOINT ["/rails/bin/docker-entrypoint"]
5952

6053
# Start the server by default, this can be overwritten at runtime
6154
EXPOSE 3000
62-
CMD ["./bin/rails", "server"]
55+
CMD ["./bin/rails", "server", "--trace"]

app/models/airline.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ class Airline < CouchbaseOrm::Base
1717
n1ql :by_country, emit_key: :country, query_fn: proc { |bucket, values, options|
1818
offset = options.delete(:offset) || 0
1919
limit = options.delete(:limit) || 10
20-
cluster.query("SELECT * FROM `#{bucket.name}` WHERE type = 'airline' AND country = #{quote(values[0])} ORDER BY name ASC LIMIT #{limit} OFFSET #{offset}", options)
20+
cluster.query("SELECT * FROM `#{bucket.name}` WHERE type = 'airline' AND country = #{quote(values[0])} ORDER BY name ASC LIMIT #{limit} OFFSET #{offset}")
2121
}
2222
end

0 commit comments

Comments
 (0)