<commit_before>FROM ruby:2.7.4-alpine3.14 as build-env

# Build options:
# --build-arg VERSION=4.0.4 --build-arg ROLLBAR_API_KEY=abc123

# VERSION is the semantic version or GIT SHA
# ROLLBAR_API_KEY is a rollbar key with post_server_item access

# With no build args the build uses VERSION=latest and no rollbar upload

ARG RAILS_ROOT=/app

WORKDIR $RAILS_ROOT

ENV RAILS_ENV=production
ENV NODE_ENV=production
ENV SECRET_KEY_BASE=abc
ENV DATABASE_URL=postgresql:does_not_exist
ENV APARTMENT_DISABLE_INIT=true

ENV BUNDLE_APP_CONFIG="$RAILS_ROOT/.bundle"
ENV RAILS_GROUPS="build"

RUN apk update \
  && apk upgrade \
  && apk add --update --no-cache \
     build-base curl-dev git postgresql-dev \
     yaml-dev zlib-dev nodejs yarn cmake tzdata \
     shared-mime-info sassc curl

COPY Gemfile* package.json yarn.lock ./
COPY ./config/secrets.yml.example ./config/k8s/secrets.yml

RUN gem install bundler \
  && bundle config frozen 1 \
  && bundle install --without test linter development ci --with build

RUN yarn install
COPY . .

ARG VERSION=latest

RUN printf 'APP_VERSION="%s".freeze\n' "$VERSION" > config/version.rb \
  && bin/rails assets:precompile

RUN rm -rf node_modules client tmp/cache spec \
  && bundle install --without test linter development ci build \
  && bundle clean --force \
  && rm -rf /usr/local/bundle/cache/*.gem \
  && find /usr/local/bundle/gems/ -name "*.c" -delete \
  && find /usr/local/bundle/gems/ -name "*.o" -delete

ARG ROLLBAR_API_KEY
ENV ROLLBAR_API_KEY=${ROLLBAR_API_KEY}

RUN sh bin/upload_source_maps.sh $VERSION \
  && find public/packs -name "*.map*" | xargs /bin/rm


##############
FROM ruby:2.7.4-alpine3.14

ARG RAILS_ROOT=/app

WORKDIR $RAILS_ROOT

ENV RAILS_ENV=production
ENV RAILS_LOG_TO_STDOUT=1
ENV RAILS_SERVE_STATIC_FILES=1

RUN apk update \
  && apk upgrade \
  && apk add --update --no-cache \
     tzdata postgresql-client bash \
     shared-mime-info git \
  && addgroup -S app-user && adduser -S app-user -G app-user
<commit_msg>Remove rollbar from docker<commit_after>FROM ruby:2.7.4-alpine3.14 as build-env

# Build options:
# --build-arg VERSION=4.0.4

# VERSION is the semantic version or GIT SHA

# With no build args the build uses VERSION=latest

ARG RAILS_ROOT=/app

WORKDIR $RAILS_ROOT

ENV RAILS_ENV=production
ENV NODE_ENV=production
ENV SECRET_KEY_BASE=abc
ENV DATABASE_URL=postgresql:does_not_exist
ENV APARTMENT_DISABLE_INIT=true

ENV BUNDLE_APP_CONFIG="$RAILS_ROOT/.bundle"
ENV RAILS_GROUPS="build"

RUN apk update \
  && apk upgrade \
  && apk add --update --no-cache \
     build-base curl-dev git postgresql-dev \
     yaml-dev zlib-dev nodejs yarn cmake tzdata \
     shared-mime-info sassc curl

COPY Gemfile* package.json yarn.lock ./
COPY ./config/secrets.yml.example ./config/k8s/secrets.yml

RUN gem install bundler \
  && bundle config frozen 1 \
  && bundle install --without test linter development ci --with build

RUN yarn install
COPY . .

ARG VERSION=latest

RUN printf 'APP_VERSION="%s".freeze\n' "$VERSION" > config/version.rb \
  && bin/rails assets:precompile

RUN rm -rf node_modules client tmp/cache spec \
  && bundle install --without test linter development ci build \
  && bundle clean --force \
  && rm -rf /usr/local/bundle/cache/*.gem \
  && find /usr/local/bundle/gems/ -name "*.c" -delete \
  && find /usr/local/bundle/gems/ -name "*.o" -delete

##############
FROM ruby:2.7.4-alpine3.14

ARG RAILS_ROOT=/app

WORKDIR $RAILS_ROOT

ENV RAILS_ENV=production
ENV RAILS_LOG_TO_STDOUT=1
ENV RAILS_SERVE_STATIC_FILES=1

RUN apk update \
  && apk upgrade \
  && apk add --update --no-cache \
     tzdata postgresql-client bash \
     shared-mime-info git \
  && addgroup -S app-user && adduser -S app-user -G app-user

{'fraction_non_alphanumeric': 0.11949516648764769, 'fraction_numerical': 0.01100966702470462, 'mean_word_length': 3.445107398568019, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '849817', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1353, 'n_words': 363}