FROM teacherspayteachers/tptci as tptci 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 CI testing
  netcat-openbsd \
  # build-base is required for mysql2 and pg gems
  build-base \
  # mariadb-dev is required for mysql2
  mariadb-dev

RUN gem install bundler -v '~> 2.2'

RUN bundle config –global ignore_messages true

RUN mkdir /app WORKDIR /app

ENV RAILS_ENV=test APP_ENV=test APP_NAME=<%= Tpt::Rails.app_name %>

COPY Gemfile Gemfile.lock .ruby-version /app/

RUN bundle install –jobs=4 –retry=3

COPY . .

COPY –from=tptci /usr/bin/tptci /usr/bin/tptci