FROM ruby:3.2-slim

ENV BUNDLE_WITHOUT="development test"

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      build-essential \
      libxml2-dev \
      libxslt1-dev \
      pkg-config \
      libmariadb-dev-compat \
      libmariadb-dev \
      mariadb-client \
      ca-certificates \
      curl && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY Gemfile Gemfile.lock ./
RUN bundle install

COPY lib ./lib
COPY run_all.sh entrypoint.sh ./
RUN chmod +x /app/run_all.sh /app/entrypoint.sh

# Scrapers are bind-mounted by compose
CMD ["/app/entrypoint.sh"]
