Skip to content

Commit

Permalink
fix prod dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
loftwah committed Jul 13, 2024
1 parent affb83b commit 14fd764
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ 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
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config curl && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install --no-install-recommends -y nodejs

# Install application gems
COPY Gemfile Gemfile.lock ./
Expand All @@ -32,9 +34,16 @@ RUN --mount=type=bind,target=. \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile

# Install Node.js packages
COPY package.json package-lock.json ./
RUN npm install

# Copy application code
COPY . .

# Run Vite build
RUN npx vite build

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/

Expand Down

0 comments on commit 14fd764

Please sign in to comment.