asxpio/Dockerfile
Sergei Poljanski c56469f323
All checks were successful
Tests / test (push) Successful in 23s
Build and Deploy to Production / test (push) Successful in 22s
Build and Deploy to Production / build (push) Successful in 1m0s
Build and Deploy to Production / deploy (push) Successful in 40s
Revert "Ruby 4.0.9, in the image and the flake"
The deploy (run 458) crash-looped: under Ruby 4 the default bigdecimal
is 4.0.1, and ttfunk 1.8.0 (prawn, invoice PDFs) requires bigdecimal
~> 3.1, so the app fails to load (Gem::ConflictError). The pre-merge
boot test stopped at the database connection, before prawn was
loaded, so it missed this. Production was rolled back by hand to
768b10e1; this puts main back in step.

Assisted-by: Claude:opus-5-5
2026-11-13 03:40:58 +04:00

33 lines
956 B
Docker

FROM ruby:3.4.12-slim-bookworm
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
imagemagick \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd -g 11000 asxpio \
&& useradd -d /app -u 21000 -g 11000 -m -s /bin/bash asxpio
WORKDIR /app
USER asxpio
ENV GEM_HOME=/app/bundle
ENV PATH="${GEM_HOME}/bin:${PATH}"
COPY --chown=asxpio Gemfile Gemfile.lock* ./
ENV BUNDLE_FROZEN=true
RUN bundle install --without development:test
COPY --chown=asxpio . .
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 puma -b tcp://0.0.0.0:${PUMA_PORT} -t ${PUMA_THREADS} --preload"]