def tarball
      return @tarball if defined? @tarball

      require 'open3'
      Dir.mktmpdir do |tmpdir|
        definition.each do |options|
          glob          = options.fetch(:glob)
          prefix        = options[:prefix]
          ignore_hidden = options[:ignore_hidden]

          files = Dir[glob]
          files.reject! { |f| f.start_with?('.') } if ignore_hidden

          dest = prefix ? File.join(tmpdir, prefix) : tmpdir

          FileUtils.mkpath(dest)
          FileUtils.cp_r(files, dest)
        end

        excludes.each do |path|
          full_path = File.join(tmpdir, path)
          if File.file?(full_path)
            File.unlink(File.join(tmpdir, path))
          end
        end

        # Specify the correct ruby version in the Dockerfile.
        bundle_dockerfile = File.join(tmpdir, "Dockerfile")
        content = IO.read(bundle_dockerfile)
        content = content.gsub("{{ruby_version}}", ruby_version)
        IO.write bundle_dockerfile, content

        if dockerfile
          File.unlink bundle_dockerfile
          FileUtils.cp dockerfile, bundle_dockerfile
        end

        # Find hash of all files we're sending over.
        digest = Digest::SHA1.new
        Dir[File.join(tmpdir, '**/*')].each do |path|
          if File.file? path
            open path, 'r' do |file|
              digest.update file.read
            end
          end
        end
        @image_name = "hoosegow:#{digest.hexdigest}"

        # Create tarball of the tmpdir.
        stdout, stderr, status = Open3.capture3 'tar', '-c', '-C', tmpdir, '.'

        raise Hoosegow::ImageBuildError, stderr unless stderr.empty?

        @tarball = stdout
      end
    end
Tarball of this gem and the inmate file. Used for building an image.

Returns the tar file's bytes.