dock'er? i hardly

This commit is contained in:
24c02 2026-01-30 13:37:09 -05:00
parent 02d812e1f0
commit 87ca70ba60

View file

@ -9,6 +9,7 @@
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.4.4
ARG NODE_VERSION=22
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
# Rails app lives here
@ -28,9 +29,13 @@ ENV RAILS_ENV="production" \
# Throw-away build stage to reduce size of final image
FROM base AS build
# Install packages needed to build gems
# Install packages needed to build gems and Node.js/Yarn
ARG NODE_VERSION
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config && \
apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config curl && \
curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \
apt-get install --no-install-recommends -y nodejs && \
corepack enable && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Install application gems
@ -39,13 +44,17 @@ RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile
# Install Node.js dependencies
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# Copy application code
COPY . .
# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
# Build Vite assets and precompile Rails assets
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile