# Build Bundler from source and install the gem so the container has the bundled "bundler" executable
FROM ruby:3.2-slim
# Install build dependencies needed to build native extensions and the gem
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends \
build-essential \
git \
zlib1g-dev \
liblzma-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set working directory to the repository root
WORKDIR /app
# Copy the repository contents into the image
COPY . .
# Build the gem from the gemspec and install it
RUN gem build bundler.gemspec \
&& gem install bundler-*.gem --no-document
# Default to an interactive shell so users can run bundler commands, tests, etc.
CMD ["bash"]