-
Notifications
You must be signed in to change notification settings - Fork 0
add Dockerfile and associated configuration #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Docker containerization support to the CircleCI usage API exporter project. It introduces a Dockerfile and associated configuration to enable running the application in a containerized environment.
- Added Dockerfile with Python 3.12 slim base image and dependency installation
- Created entrypoint.sh script to orchestrate running the usage report generation and optional Datadog submission
- Updated Python script with shebang for direct execution
- Added comprehensive Docker usage documentation with examples
Reviewed Changes
Copilot reviewed 4 out of 7 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Dockerfile | Defines container image with Python 3.12, sets up working directory, and installs dependencies |
| entrypoint.sh | Shell script that executes the main workflow and conditionally sends reports to Datadog |
| src/get_usage_report.py | Added shebang line for direct script execution |
| README.md | Added Docker usage section with build and run examples |
| #!/bin/bash | ||
| set -e | ||
|
|
||
| ./get_usage_report.py |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script assumes get_usage_report.py is executable, but the Dockerfile doesn't set execute permissions. This will cause a permission denied error when the container runs.
| if [ "${SEND_TO_DATADOG}" = "true" ]; then | ||
| for csv_file in /tmp/reports/*.csv; do | ||
| # Check if the file actually exists (in case the glob didn't match anything) | ||
| if [ -e "$csv_file" ]; then |
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to get_usage_report.py, this script assumes send_to_datadog.py is executable, but no execute permissions are set in the Dockerfile.
| if [ -e "$csv_file" ]; then | |
| if [ -e "$csv_file" ]; then | |
| chmod +x ./send_to_datadog.py |
| COPY src/ ./ | ||
| COPY requirements.txt ./ | ||
| COPY entrypoint.sh ./ | ||
|
|
Copilot
AI
Jul 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entrypoint.sh script needs execute permissions to run properly. Add a RUN command after the COPY operations to set execute permissions: RUN chmod +x entrypoint.sh get_usage_report.py send_to_datadog.py
| RUN chmod +x entrypoint.sh |
This PR will:
Dockerfileandentrypoint.shfile to run./get_usage_report.pyand, optionally,./send_to_datadog.py.README.mdto provide some instructions for building and running the given docker image.requirements.txtfile (so that python packages can be installed in the Docker Image)src/send_to_datadog.pyexecutable#!/usr/bin/env python3toget_usage_report.pyso that the shell knows to runget_usage_report.pyusing python3.