This commit is contained in:
Ole-Morten Duesund 2025-06-06 18:50:32 +02:00
commit 7640f045f1
6 changed files with 448 additions and 0 deletions

34
Containerfile Normal file
View file

@ -0,0 +1,34 @@
# Use official Ruby image
FROM ruby:3.2-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 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"]