Files
baclight/production.Dockerfile
T

44 lines
1.2 KiB
Docker
Raw Normal View History

2022-12-28 05:05:08 +00:00
FROM ruby:3.2.0-slim
2022-04-24 22:52:31 -07:00
RUN apt-get update -qq && apt-get install -yq --no-install-recommends \
build-essential \
gnupg2 \
libpq-dev \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV LANG=C.UTF-8 \
BUNDLE_JOBS=4 \
BUNDLE_RETRY=3 \
2022-04-24 23:02:14 -07:00
RAILS_ENV=production
2022-04-24 22:52:31 -07:00
RUN gem update --system && gem install bundler
WORKDIR /usr/src/app
COPY Gemfile* ./
RUN bundle config frozen true \
&& bundle config jobs 4 \
&& bundle config deployment true \
&& bundle config without 'development test' \
&& bundle install
COPY . .
# Precompile assets
# SECRET_KEY_BASE or RAILS_MASTER_KEY is required in production, but we don't
# want real secrets in the image or image history. The real secret is passed in
# at run time
ARG SECRET_KEY_BASE=fakekeyforassets
2022-04-24 23:14:32 -07:00
RUN bin/rails assets:clobber && bundle exec rails assets:precompile
2022-04-24 22:52:31 -07:00
2022-09-10 17:57:08 -07:00
# Run database migrations when deploying to Render. It is not great, maybe there's a better way?
2022-09-10 17:36:21 -07:00
# https://community.render.com/t/release-command-for-db-migrations/247/6
2022-09-10 17:57:08 -07:00
ARG RENDER
2022-09-10 17:30:26 -07:00
ARG DATABASE_URL
2022-09-10 17:53:39 -07:00
RUN if [ -z "$RENDER" ]; then echo "var is unset"; else bin/rails db:migrate; fi
2022-09-10 17:24:59 -07:00
2022-04-24 22:52:31 -07:00
EXPOSE 3000
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]