2025-06-06 18:50:32 +02:00
|
|
|
# Use official Ruby image
|
2025-06-07 13:23:08 +02:00
|
|
|
FROM docker.io/library/ruby:3.4-slim
|
2025-06-06 18:50:32 +02:00
|
|
|
|
|
|
|
|
# Set working directory
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install system dependencies
|
|
|
|
|
RUN apt-get update && apt-get install -y \
|
2025-06-10 21:09:37 +02:00
|
|
|
build-essential curl \
|
2025-06-06 18:50:32 +02:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
# Copy Gemfile and Gemfile.lock
|
|
|
|
|
COPY Gemfile* ./
|
|
|
|
|
|
|
|
|
|
# Install Ruby gems
|
|
|
|
|
RUN bundle install --without development
|
|
|
|
|
|
2025-06-06 18:55:54 +02:00
|
|
|
# Copy responses file first
|
|
|
|
|
COPY responses.yml ./
|
|
|
|
|
|
2025-06-06 18:50:32 +02:00
|
|
|
# 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"]
|