# Use official Ruby image FROM docker.io/library/ruby:3.4-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ && rm -rf /var/lib/apt/lists/* # Copy Gemfile and Gemfile.lock COPY Gemfile* ./ # Install Ruby gems RUN bundle install --without development # Copy responses file first COPY responses.yml ./ # Copy application code COPY . . # Create non-root user RUN groupadd -r appuser && useradd -r -g appuser appuser RUN chown -R appuser:appuser /app USER appuser # Expose port EXPOSE 4567 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:4567/health || exit 1 # Default command CMD ["ruby", "app.rb"]