Skip to content

Commit

Permalink
Merge pull request #9 from newrelic/ruby_init_container
Browse files Browse the repository at this point in the history
Add Ruby agent Dockerfile
  • Loading branch information
hannahramadan authored May 21, 2024
2 parents 43235fc + 5cfcc5e commit 9d1b5a0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ruby/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# To build one auto-instrumentation image for Ruby, please:
# - Ensure the packages are installed in the `/instrumentation` directory. This is required as when instrumenting the pod,
# one init container will be created to copy all the content in `/instrumentation` directory to your app's container.
# - Grant the necessary access to `/instrumentation` directory. `chmod -R go+r /instrumentation`

FROM ruby:latest AS build
WORKDIR /operator-build
ADD Gemfile .
RUN BUNDLE_PATH=workspace bundle install

FROM busybox
COPY --from=build /operator-build /operator-build
WORKDIR /operator-build
# Shell command to search inside the `workspace/ruby` directory for a directory that starts with `newrelic_rpm`.
# Example of a found result: workspace/ruby/3.2.0/gems/newrelic_rpm-9.9.0
# Copy the result into a new directory called `/instrumentation`.
RUN sh -c "find 'workspace/ruby/' -type d -name newrelic_rpm\\* -exec cp -r '{}' /instrumentation \\;"
RUN chmod -R go+r /instrumentation
RUN rm -rf /operator-build
5 changes: 5 additions & 0 deletions ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'newrelic_rpm'

0 comments on commit 9d1b5a0

Please sign in to comment.