Skip to content

Commit b2b61f6

Browse files
committed
update docker file
1 parent 1182244 commit b2b61f6

File tree

3 files changed

+35
-27
lines changed

3 files changed

+35
-27
lines changed

Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@ FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
77
# Rails app lives here
88
WORKDIR /rails
99

10+
# Install base packages
11+
RUN apt-get update -qq && \
12+
apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 libvips
13+
1014
# Set production environment
1115
ENV RAILS_ENV="production" \
1216
BUNDLE_DEPLOYMENT="1" \
1317
BUNDLE_PATH="/usr/local/bundle" \
1418
BUNDLE_WITHOUT="development"
1519

16-
1720
# Throw-away build stage to reduce size of final image
1821
FROM base as build
1922

2023
# Install packages needed to build gems and node modules
21-
RUN apt-get update -qq && \
22-
apt-get install --no-install-recommends -y build-essential curl git libvips node-gyp pkg-config python-is-python3
24+
RUN apt-get install --no-install-recommends -y build-essential git node-gyp pkg-config python-is-python3
2325

2426
# Install JavaScript dependencies
2527
ARG NODE_VERSION=20.11.0
@@ -36,7 +38,6 @@ RUN bundle install && \
3638
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
3739
bundle exec bootsnap precompile --gemfile
3840

39-
4041
# Install node modules
4142
COPY package.json yarn.lock ./
4243
RUN yarn install --frozen-lockfile
@@ -51,16 +52,17 @@ RUN bundle exec bootsnap precompile app/ lib/
5152
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
5253

5354

55+
RUN rm -rf node_modules
56+
57+
5458
# Final stage for app image
5559
FROM base
5660

57-
# Install packages needed for deployment
58-
RUN apt-get update -qq && \
59-
apt-get install --no-install-recommends -y curl libsqlite3-0 libvips && \
60-
rm -rf /var/lib/apt/lists /var/cache/apt/archives
61+
# Clean up installation packages to reduce image size
62+
RUN rm -rf /var/lib/apt/lists /var/cache/apt/archives
6163

6264
# Copy built artifacts: gems, application
63-
COPY --from=build /usr/local/bundle /usr/local/bundle
65+
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
6466
COPY --from=build /rails /rails
6567

6668
# Run and own only the runtime files as a non-root user for security

Gemfile.lock

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ GEM
8787
annotate (3.2.0)
8888
activerecord (>= 3.2, < 8.0)
8989
rake (>= 10.4, < 14.0)
90-
appsignal (3.7.5)
90+
appsignal (3.7.6)
9191
rack
9292
ast (2.4.2)
9393
authentication-zero (2.16.36)
@@ -162,7 +162,7 @@ GEM
162162
rubocop
163163
smart_properties
164164
error_highlight (0.6.0)
165-
erubi (1.12.0)
165+
erubi (1.13.0)
166166
et-orbi (1.2.11)
167167
tzinfo
168168
fugit (1.11.0)
@@ -204,6 +204,7 @@ GEM
204204
logfmt (>= 0.0.10)
205205
sqlite3
206206
logfmt (0.0.10)
207+
logger (1.6.0)
207208
loofah (2.22.0)
208209
crass (~> 1.0.2)
209210
nokogiri (>= 1.12.0)
@@ -239,20 +240,20 @@ GEM
239240
net-smtp (0.5.0)
240241
net-protocol
241242
nio4r (2.7.3)
242-
nokogiri (1.16.5-aarch64-linux)
243+
nokogiri (1.16.6-aarch64-linux)
243244
racc (~> 1.4)
244-
nokogiri (1.16.5-arm64-darwin)
245+
nokogiri (1.16.6-arm64-darwin)
245246
racc (~> 1.4)
246-
nokogiri (1.16.5-x86_64-darwin)
247+
nokogiri (1.16.6-x86_64-darwin)
247248
racc (~> 1.4)
248-
nokogiri (1.16.5-x86_64-linux)
249+
nokogiri (1.16.6-x86_64-linux)
249250
racc (~> 1.4)
250251
pagy (6.5.0)
251252
parallel (1.25.1)
252-
parser (3.3.2.0)
253+
parser (3.3.3.0)
253254
ast (~> 2.4.1)
254255
racc
255-
prism (0.29.0)
256+
prism (0.30.0)
256257
propshaft (0.9.0)
257258
actionpack (>= 7.0.0)
258259
activesupport (>= 7.0.0)
@@ -265,7 +266,7 @@ GEM
265266
nio4r (~> 2.0)
266267
raabro (1.4.0)
267268
racc (1.8.0)
268-
rack (3.1.0)
269+
rack (3.1.3)
269270
rack-mini-profiler (3.3.1)
270271
rack (>= 1.2.0)
271272
rack-proxy (0.7.7)
@@ -316,14 +317,16 @@ GEM
316317
zeitwerk (~> 2.6)
317318
rainbow (3.1.1)
318319
rake (13.2.1)
320+
rbs (3.5.1)
321+
logger
319322
rdoc (6.7.0)
320323
psych (>= 4.0.0)
321324
regexp_parser (2.9.2)
322-
reline (0.5.8)
325+
reline (0.5.9)
323326
io-console (~> 0.5)
324327
rexml (3.3.0)
325328
strscan
326-
rubocop (1.63.5)
329+
rubocop (1.64.1)
327330
json (~> 2.3)
328331
language_server-protocol (>= 3.17.0)
329332
parallel (~> 1.10)
@@ -339,9 +342,10 @@ GEM
339342
rubocop-performance (1.21.0)
340343
rubocop (>= 1.48.1, < 2.0)
341344
rubocop-ast (>= 1.31.1, < 2.0)
342-
ruby-lsp (0.17.2)
345+
ruby-lsp (0.17.3)
343346
language_server-protocol (~> 3.17.0)
344-
prism (>= 0.29.0, < 0.30)
347+
prism (>= 0.29.0, < 0.31)
348+
rbs (>= 3, < 4)
345349
sorbet-runtime (>= 0.5.10782)
346350
ruby-lsp-rails (0.3.7)
347351
ruby-lsp (>= 0.17.0, < 0.18.0)
@@ -360,21 +364,21 @@ GEM
360364
activejob (>= 7)
361365
activerecord (>= 7)
362366
railties (>= 7)
363-
solid_queue (0.3.2)
367+
solid_queue (0.3.3)
364368
activejob (>= 7.1)
365369
activerecord (>= 7.1)
366370
concurrent-ruby (>= 1.3.1)
367371
fugit (~> 1.11.0)
368372
railties (>= 7.1)
369-
sorbet-runtime (0.5.11428)
373+
sorbet-runtime (0.5.11432)
370374
sqlite3 (1.7.3-aarch64-linux)
371375
sqlite3 (1.7.3-arm64-darwin)
372376
sqlite3 (1.7.3-x86_64-darwin)
373377
sqlite3 (1.7.3-x86_64-linux)
374-
standard (1.36.0)
378+
standard (1.37.0)
375379
language_server-protocol (~> 3.17.0.2)
376380
lint_roller (~> 1.0)
377-
rubocop (~> 1.63.0)
381+
rubocop (~> 1.64.0)
378382
standard-custom (~> 1.0.0)
379383
standard-performance (~> 1.4)
380384
standard-custom (1.0.2)
@@ -385,7 +389,7 @@ GEM
385389
rubocop-performance (~> 1.21.0)
386390
standardrb (1.0.1)
387391
standard
388-
stringio (3.1.0)
392+
stringio (3.1.1)
389393
strscan (3.1.0)
390394
thor (1.3.1)
391395
timeout (0.4.1)

app/views/layouts/application.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
<%= render "shared/top_banner" %>
1818
<%= render "shared/navbar" %>
1919
<%= render "shared/flashes" %>
20+
2021
<div class="min-h-screen">
2122
<%= yield %>
2223
</div>
24+
2325
<%= render "shared/footer" %>
2426
</body>
2527
</html>

0 commit comments

Comments
 (0)