Skip to content

Commit

Permalink
Merge pull request #2 from DataDog/sarahchen6/add-docker-support
Browse files Browse the repository at this point in the history
Add docker support
  • Loading branch information
lloeki authored Sep 13, 2024
2 parents cbff8ce + 59de29f commit aa532a3
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.envrc
/vendor
/records
/.env
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Ruby base image
FROM ghcr.io/datadog/images-rb/engines/ruby:3.4

# Install dependencies
COPY Gemfile Gemfile.lock catadog.gemspec /app/
WORKDIR /app
RUN bundle install

# Add files
COPY /bin/ /app/bin/
COPY /mocks/ /app/mocks/
COPY entrypoint.rb /

# Set entrypoint
ENTRYPOINT ["ruby", "/entrypoint.rb"]
2 changes: 1 addition & 1 deletion bin/catadog
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ module Datadog
when "-F", "--no-forward"
settings.forward = false
when "-f", "--agent-host"
settings.agent_host = IPAddr.new(args.shift)
settings.agent_host = args.shift
when "-g", "--agent-port"
settings.agent_port = Integer(args.shift)
when "-r", "--record"
Expand Down
22 changes: 22 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
app:
image: catadog
command: --agent-host agent
depends_on:
- agent
ports:
- "8126:8128"
stdin_open: true
tty: true
volumes:
- ./records:/app/records
agent:
image: datadog/agent:7.52.0
env_file:
- ".env"
environment:
- DD_APM_ENABLED=true
- DD_BIND_HOST=0.0.0.0
- DD_APM_NON_LOCAL_TRAFFIC=true
- DD_REMOTE_CONFIGURATION_ENABLED=true

5 changes: 5 additions & 0 deletions entrypoint.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if ARGV.empty? || ARGV == %W[bundle exec catadog]
exec "bundle exec catadog -h 0.0.0.0"
else
exec "bundle exec catadog -h 0.0.0.0 #{ARGV.join(" ")}"
end

0 comments on commit aa532a3

Please sign in to comment.