# Ruby {{ config.rubyVersion or '3.2' }} Dockerfile FROM ruby:{{ config.rubyVersion or '3.2' }}-alpine WORKDIR /app # Install dependencies RUN apk add --no-cache \ build-base \ postgresql-dev \ tzdata \ nodejs \ yarn # Copy Gemfile COPY Gemfile Gemfile.lock* ./ # Install gems {% if config.developmentMode %} RUN bundle install {% else %} RUN bundle install --without development test --deployment {% endif %} # Copy application code COPY . . # Create non-root user RUN addgroup -g 1001 -S ruby && \ adduser -S ruby -u 1001 && \ chown -R ruby:ruby /app USER ruby # Expose port EXPOSE {{ config.port or '3000' }} {% if config.developmentMode %} # Development mode ENV RAILS_ENV=development CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0", "-p", "{{ config.port or '3000' }}"] {% else %} # Production mode ENV RAILS_ENV=production ENV RACK_ENV=production # Precompile assets for Rails {% if config.framework == 'rails' %} RUN bundle exec rake assets:precompile {% endif %} # Start application with Puma (production-grade server) CMD ["bundle", "exec", "puma", "-b", "tcp://0.0.0.0:{{ config.port or '3000' }}"] {% endif %}