gonzedge/rambling-trie

View on GitHub
Dockerfile.benchmark

Summary

Maintainability
Test Coverage
FROM ruby:3.3.6

ARG VERSION=2.5.1
ARG FROM_GITHUB=false

WORKDIR /usr/rambling-trie
RUN git init

# Generate benchmark-specific minimal Gemfile
RUN echo "source 'https://rubygems.org'\n\ngem 'rake'\ngem 'rubyzip'\n" > Gemfile && \
  if [ "$FROM_GITHUB" = "false" ]; \
  then echo "gem 'rambling-trie', '=$VERSION'" >> Gemfile; \
  else echo "gem 'rambling-trie', github: 'gonzedge/rambling-trie', ref: '$VERSION'" >> Gemfile; \
  fi

# Install dependencies
RUN bundle install

# Copy only what is necessary to run a benchmark
COPY assets ./assets
COPY tasks ./tasks

# Generate minimal Rakefile
RUN echo "# frozen_string_literal: true\n\n" > Rakefile && \
  echo "require 'rambling-trie'\n" >> Rakefile && \
  echo "require_relative 'tasks/performance'\n" >> Rakefile && \
  echo "require_relative 'tasks/serialization'\n" >> Rakefile && \
  echo "require_relative 'tasks/ips'\n" >> Rakefile