mirror of
https://github.com/System-End/cdn.git
synced 2026-04-19 22:05:13 +00:00
dock'er? i hardly
This commit is contained in:
parent
02d812e1f0
commit
87ca70ba60
1 changed files with 12 additions and 3 deletions
15
Dockerfile
15
Dockerfile
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue