All checks were successful
Tests / test (push) Successful in 32s
Same move as asxpio: ruby:4.0.9-slim-bookworm and nixpkgs' ruby_4_0 (4.0.9) for the tests; BUNDLE_WITHOUT instead of Bundler 4's removed --without; Puma started through bundle exec, so the lockfile picks the gems and not Ruby 4's newer defaults (asxpio crash-looped on bigdecimal 4.0.1 without it). Lockfile stays BUNDLED WITH 2.7.2. Checked on ops with the production env, as a separate container: boots to Listening on Ruby 4.0.9 and serves / (302, as production does). Assisted-by: Claude:opus-5-5
33 lines
953 B
Docker
33 lines
953 B
Docker
FROM ruby:4.0.9-slim-bookworm
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
libpq-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN groupadd -g 11000 bingo \
|
|
&& useradd -d /app -u 21000 -g 11000 -m -s /bin/bash bingo
|
|
|
|
WORKDIR /app
|
|
USER bingo
|
|
|
|
ENV GEM_HOME=/app/bundle
|
|
ENV PATH="${GEM_HOME}/bin:${PATH}"
|
|
|
|
COPY --chown=bingo Gemfile Gemfile.lock* ./
|
|
ENV BUNDLE_FROZEN=true
|
|
ENV BUNDLE_WITHOUT=development:test
|
|
RUN bundle install
|
|
|
|
COPY --chown=bingo . .
|
|
|
|
ENV PUMA_PORT=3000
|
|
ENV PUMA_THREADS="4:16"
|
|
ENV RACK_ENV=production
|
|
EXPOSE 3000
|
|
|
|
# Slim image has no curl; ruby is right there.
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
|
CMD ruby -rnet/http -e 'port = ENV.fetch("PUMA_PORT", "3000"); exit(Net::HTTP.get_response(URI("http://127.0.0.1:#{port}/healthz")).code == "200" ? 0 : 1)'
|
|
|
|
CMD ["sh", "-c", "exec bundle exec puma -b tcp://0.0.0.0:${PUMA_PORT} -t ${PUMA_THREADS} --preload"]
|