Skip to content

Commit ab0bd44

Browse files
justin808claude
andcommitted
Fix critical issues from code review
- Fix Gemfile.lock Ruby version (3.4.3 → 3.4.6) to match .ruby-version - Update Dockerfile CMD to use Thruster as documented - Fix Dockerfile lint warnings: - Change 'as' to 'AS' for FROM statements (lines 3, 35) - Remove SECRET_KEY_BASE from ENV (security warning) - Set SECRET_KEY_BASE only during RUN command for asset precompilation - Add version constraint to thruster gem (~> 0.1) - Set early_hints debug to false in production (was true) These changes resolve: - CI bundler failures (frozen lockfile mismatch) - Dockerfile build failures (exit code 16) - Docker security warnings - Configuration inconsistency (Dockerfile vs Procfile) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1e04fd2 commit ab0bd44

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

.controlplane/Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
22
ARG RUBY_VERSION=3.4.6
3-
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
3+
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim AS base
44

55
# Current commit hash environment variable
66
ARG GIT_COMMIT
@@ -32,7 +32,7 @@ ENV RAILS_ENV="production" \
3232

3333

3434
# Throw-away build stage to reduce size of final image
35-
FROM base as build
35+
FROM base AS build
3636

3737
# Install application gems
3838
COPY Gemfile Gemfile.lock ./
@@ -60,23 +60,26 @@ COPY --from=build /app /app
6060

6161
RUN chmod +x /app/.controlplane/*.sh
6262

63+
# Set environment variables for asset compilation
6364
ENV RAILS_ENV=production \
64-
NODE_ENV=production \
65-
SECRET_KEY_BASE=NOT_USED_NON_BLANK
66-
# compiling assets requires any value for ENV of SECRET_KEY_BASE
65+
NODE_ENV=production
6766

6867
# These files hardly ever change
6968
RUN bin/rails react_on_rails:locale
7069

7170
# These files change together, /app/lib/bs are temp build files for rescript,
7271
# and /app/client/app are the client assets that are bundled, so not needed once built
7372
# Helps to have smaller images b/c of smaller Docker Layer Caches and smaller final images
74-
RUN yarn res:build && bin/rails assets:precompile && rm -rf /app/lib/bs /app/client/app
73+
# SECRET_KEY_BASE is required for asset precompilation but is not persisted in the image
74+
RUN SECRET_KEY_BASE=precompile_placeholder yarn res:build && \
75+
SECRET_KEY_BASE=precompile_placeholder bin/rails assets:precompile && \
76+
rm -rf /app/lib/bs /app/client/app
7577

7678
# This is like the shell initialization that will take the CMD as args
7779
# For Kubernetes and ControlPlane, this is the command on the workload.
7880
ENTRYPOINT ["./.controlplane/entrypoint.sh"]
7981

8082
# Default args to pass to the entry point that can be overridden
8183
# For Kubernetes and ControlPlane, these are the "workload args"
82-
CMD ["./bin/rails", "server"]
84+
# Use Thruster HTTP/2 proxy for optimized performance
85+
CMD ["bundle", "exec", "thrust", "bin/rails", "server"]

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ gem "rails", "~> 8.0"
1515
gem "pg"
1616

1717
gem "puma"
18-
gem "thruster"
18+
gem "thruster", "~> 0.1"
1919

2020
# Use SCSS for stylesheets
2121
gem "sass-rails"

Gemfile.lock

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ GEM
140140
factory_bot_rails (6.4.3)
141141
factory_bot (~> 6.4)
142142
railties (>= 5.0.0)
143-
ffi (1.17.2)
144143
ffi (1.17.2-arm64-darwin)
145144
ffi (1.17.2-x86_64-linux-gnu)
146145
foreman (0.88.1)
@@ -181,7 +180,6 @@ GEM
181180
matrix (0.4.2)
182181
method_source (1.1.0)
183182
mini_mime (1.1.5)
184-
mini_portile2 (2.8.9)
185183
minitest (5.26.0)
186184
mize (0.4.1)
187185
protocol (~> 2.0)
@@ -195,9 +193,6 @@ GEM
195193
net-smtp (0.5.1)
196194
net-protocol
197195
nio4r (2.7.4)
198-
nokogiri (1.18.10)
199-
mini_portile2 (~> 2.8.2)
200-
racc (~> 1.4)
201196
nokogiri (1.18.10-arm64-darwin)
202197
racc (~> 1.4)
203198
nokogiri (1.18.10-x86_64-linux-gnu)
@@ -417,6 +412,8 @@ GEM
417412
mize
418413
tins (~> 1.0)
419414
thor (1.4.0)
415+
thruster (0.1.16-arm64-darwin)
416+
thruster (0.1.16-x86_64-linux)
420417
tilt (2.4.0)
421418
timeout (0.4.3)
422419
tins (1.33.0)
@@ -453,7 +450,6 @@ GEM
453450
PLATFORMS
454451
arm64-darwin
455452
arm64-darwin-22
456-
ruby
457453
x86_64-linux
458454
x86_64-linux-gnu
459455

@@ -500,12 +496,13 @@ DEPENDENCIES
500496
spring
501497
spring-commands-rspec
502498
stimulus-rails (~> 1.3)
499+
thruster (~> 0.1)
503500
turbo-rails (~> 2.0)
504501
uglifier
505502
web-console
506503

507504
RUBY VERSION
508-
ruby 3.4.3p32
505+
ruby 3.4.6p54
509506

510507
BUNDLED WITH
511508
2.4.17

config/shakapacker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ production:
6767
# Early hints configuration
6868
early_hints:
6969
enabled: true
70-
debug: true # Outputs debug info as HTML comments
70+
debug: false # Set to true to output debug info as HTML comments

0 commit comments

Comments
 (0)