FROM ruby:4.0-slim-trixie

LABEL parent-images=ruby40

# Run updates and install additional packages
RUN apt-get -y update \
  && apt-get -y upgrade \
  && apt-get -y install build-essential curl make gcc \
  && gem update json \
  && apt remove -y build-essential make gcc \
  && apt-get -y clean \
  && rm -rf /var/lib/apt/lists/*

RUN rm -rf /usr/local/lib/ruby/gems/4.0.0/gems/json-2.18.0 \
  /usr/local/lib/ruby/gems/4.0.0/specifications/default/json-2.18.0.gemspec

RUN useradd -m -u 1010 --password '!' worker

# Run container as the worker user
USER worker 
