FROM ruby:<%= RUBY_VERSION %>-alpine

ENV LANG C.UTF-8

RUN \

apk add --no-cache \
  # temporarily adding git to allow using gems from git sources
  git \
  # bash is nice to have when we need a shell into a container
  bash \
  # tzdata is required by rails to avoid "tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile"
  tzdata \
  # busybox is useful utilities when we need a shell into a container
  busybox \
  # curl is useful when we need a shell into a container
  curl \
  # screen helps with long-running tasks in one-off pods
  screen \
  # netcat is for detecting when the DB is ready during Jenkins testing
  netcat-openbsd \
  # build-base is required for mysql2 and pg gems
  build-base \
  # mariadb-dev is required for mysql2
  mariadb-dev \
  # mariadb-client allows us to perform manual mysql queries via console when needed
  mariadb-client

RUN gem install bundler -v '~> 2.2'

RUN bundle config –global ignore_messages true

RUN mkdir /app WORKDIR /app

# Set production env for asset compilation ARG RAILS_ENV=production ARG APP_ENV=production ARG APP_NAME=<%= Tpt::Rails.app_name %>

# Add a script to be executed every time the container starts. COPY entrypoint.sh /usr/bin/

COPY Gemfile Gemfile.lock .ruby-version ./ RUN \

bundle config without 'development test' && \
bundle install --jobs=4 --retry=3

COPY . .

# TODO: Delete this? ENTRYPOINT [“entrypoint.sh”] CMD [“rails”, “server”, “-b”, “0.0.0.0”] EXPOSE 3000

ARG TPT_RELEASE_VERSION ENV TPT_RELEASE_VERSION=$TPT_RELEASE_VERSION