Spaces:
Running
Running
File size: 1,171 Bytes
2df0cf9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | # 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 %}
|