FROM ruby:4.0.6-slim-bookworm

# build-essential: puma has a native (C) extension; harmless if the
# platform-specific gem in Gemfile.lock already has a precompiled binary
# matching this base image, but keeps the build working if it doesn't.
RUN apt-get update && apt-get install --no-install-recommends -y build-essential \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY Gemfile Gemfile.lock ./
RUN bundle install

COPY . .

EXPOSE 4567
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
