Skip to content

Commit 2afbb91

Browse files
committed
fix: Package.json
1 parent 0d24b17 commit 2afbb91

23 files changed

+20942
-54
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@
3434
/config/master.key
3535

3636
/config/credentials/development.key
37+
node_modules

Dockerfile

+15-13
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,32 @@ ENV RAILS_ENV="production" \
1313
BUNDLE_PATH="/usr/local/bundle" \
1414
BUNDLE_WITHOUT="development"
1515

16+
1617
# Throw-away build stage to reduce size of final image
1718
FROM base as build
1819

1920
# Install packages needed to build gems and node modules
2021
RUN apt-get update -qq && \
21-
apt-get install --no-install-recommends -y build-essential curl git libpq-dev libvips node-gyp pkg-config python-is-python3
22+
apt-get install --no-install-recommends -y build-essential curl git libvips node-gyp pkg-config python-is-python3
23+
24+
# Install JavaScript dependencies
25+
ARG NODE_VERSION=20.11.1
26+
ARG YARN_VERSION=1.22.22
27+
ENV PATH=/usr/local/node/bin:$PATH
28+
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
29+
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
30+
npm install -g yarn@$YARN_VERSION && \
31+
rm -rf /tmp/node-build-master
2232

2333
# Install application gems
2434
COPY Gemfile Gemfile.lock ./
2535
RUN bundle install && \
2636
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
2737
bundle exec bootsnap precompile --gemfile
2838

29-
# Install node modules if package.json is present
39+
# Install node modules
3040
COPY package.json yarn.lock ./
31-
RUN if [ -f package.json ]; then \
32-
curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
33-
/tmp/node-build-master/bin/node-build "21.5.0" /usr/local/node && \
34-
npm install -g yarn@1.22.19 && \
35-
yarn install --frozen-lockfile && \
36-
rm -rf /tmp/node-build-master; \
37-
fi
41+
RUN yarn install --frozen-lockfile
3842

3943
# Copy application code
4044
COPY . .
@@ -45,21 +49,19 @@ RUN bundle exec bootsnap precompile app/ lib/
4549
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
4650
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
4751

52+
4853
# Final stage for app image
4954
FROM base
5055

5156
# Install packages needed for deployment
5257
RUN apt-get update -qq && \
53-
apt-get install --no-install-recommends -y curl libvips postgresql-client && \
58+
apt-get install --no-install-recommends -y curl libsqlite3-0 libvips && \
5459
rm -rf /var/lib/apt/lists /var/cache/apt/archives
5560

5661
# Copy built artifacts: gems, application
5762
COPY --from=build /usr/local/bundle /usr/local/bundle
5863
COPY --from=build /rails /rails
5964

60-
# Ensure mini_racer is installed for ExecJS
61-
RUN gem install mini_racer
62-
6365
# Run and own only the runtime files as a non-root user for security
6466
RUN useradd rails --create-home --shell /bin/bash && \
6567
chown -R rails:rails db log storage tmp

Gemfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ gem "turbo-rails"
2323
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
2424
gem "stimulus-rails"
2525

26+
# Bundle and process CSS [https://github.com/rails/cssbundling-rails]
27+
gem "cssbundling-rails"
28+
2629
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
2730
gem "jbuilder"
2831

@@ -82,5 +85,3 @@ gem "sidekiq"
8285
gem "ruby-vips", "~> 2.2"
8386

8487
gem "stripe", "~> 12.3"
85-
86-
gem "mini_racer"

Gemfile.lock

+3-4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ GEM
113113
concurrent-ruby (1.3.3)
114114
connection_pool (2.4.1)
115115
crass (1.0.6)
116+
cssbundling-rails (1.4.0)
117+
railties (>= 6.0.0)
116118
date (3.3.4)
117119
debug (1.9.2)
118120
irb (~> 1.10)
@@ -158,7 +160,6 @@ GEM
158160
childprocess (~> 5.0)
159161
letter_opener (1.10.0)
160162
launchy (>= 2.2, < 4)
161-
libv8-node (21.7.2.0-x86_64-linux)
162163
logger (1.6.0)
163164
loofah (2.22.0)
164165
crass (~> 1.0.2)
@@ -172,8 +173,6 @@ GEM
172173
matrix (0.4.2)
173174
mini_magick (4.12.0)
174175
mini_mime (1.1.5)
175-
mini_racer (0.12.0)
176-
libv8-node (~> 21.7.2.0)
177176
minitest (5.24.0)
178177
msgpack (1.7.2)
179178
mutex_m (0.2.0)
@@ -330,14 +329,14 @@ DEPENDENCIES
330329
bootsnap
331330
bootstrap (~> 5.3)
332331
capybara
332+
cssbundling-rails
333333
debug
334334
dotenv-rails (~> 2.8)
335335
font-awesome-sass (~> 5.15.1)
336336
image_processing (~> 1.2)
337337
importmap-rails
338338
jbuilder
339339
letter_opener
340-
mini_racer
341340
pg (~> 1.1)
342341
puma (>= 5.0)
343342
rails (~> 7.1.3, >= 7.1.3.4)

Procfile.dev

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
web: env RUBY_DEBUG_OPEN=true bin/rails server
2+
css: yarn watch:css
3+
sidekiq: bundle exec sidekiq -c 3

app/assets/builds/.keep

Whitespace-only changes.

0 commit comments

Comments
 (0)