FROM cloudron/base:5.1.0@sha256:1c0666c9abe9e2090d33686826d4e97769b799124573118d41e0d7485135748e

RUN mkdir -p /app/code
WORKDIR /app/code

COPY Gemfile Gemfile.lock* /app/code/
RUN bundle install --without development test

COPY . /app/code/

RUN RAILS_ENV=production SECRET_KEY_BASE=placeholder bundle exec rake assets:precompile 2>/dev/null || true

ADD supervisor/* /etc/supervisor/conf.d/
RUN ln -sf /run/supervisord.log /var/log/supervisor/supervisord.log

CMD [ "/app/code/start.sh" ]
