basecamp-local_time
SUCCESS
35m 29s
History Source
SummaryIterations2Transcript40Dockerfile
Dockerfile48 lines · 1331 chars
FROM ruby:3.2-slim

ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8

# Install system dependencies including Node.js and Yarn
RUN apt-get update -qq && \
  apt-get install -y --no-install-recommends \
    build-essential \
    libxml2-dev libxslt1-dev zlib1g-dev \
    libpq-dev curl git ca-certificates \
    libyaml-dev \
 && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
 && apt-get install -y --no-install-recommends nodejs \
 && npm install -g yarn \
 && rm -rf /var/lib/apt/lists/*

# Ensure /bin/sh is Bash to improve shell quoting in some environments
RUN ln -sf /bin/bash /bin/sh

# Create workdir
WORKDIR /usr/src/app

# Copy Gemfile and gemspec first to leverage Docker cache
COPY Gemfile Gemfile.lock ./
COPY local_time.gemspec ./

# Copy lib directory early to satisfy gemspec requirements during bundle install
COPY lib ./lib

# Install Ruby gems
RUN gem install bundler -v 2.4.22 && \
  bundle config --global build.nokogiri --use-system-libraries && \
  bundle install --jobs 4 --without production

# Copy package manifests and install JS deps
COPY package.json yarn.lock ./
RUN yarn install

# Copy the rest of the app
COPY . .

# Build assets (JS via Rollup via yarn)
RUN bundle exec rake assets:compile

# Default command: run the test suite for the gem
CMD ["bundle", "exec", "rake", "test"]