-
Notifications
You must be signed in to change notification settings - Fork 29
Add devcontainer configuration #72
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b347f1d
Add devcontainer configuration
soberpeach e9d925a
Fix launch.json and update readme
soberpeach 27a71b0
CI fix
soberpeach ae696fa
Update README.md
soberpeach 3b397f0
Update README.md
soberpeach faa603b
CI fix
soberpeach 56cc3df
More CI fixes
soberpeach 187c110
Add rake as runtime dependency
soberpeach 555ad05
Make test-unit runtime dependency
soberpeach 23339ce
Add runtime dependency
soberpeach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Use a Ruby image >= 3.1, as required by some dependencies like recent nokogiri | ||
| FROM ruby:3.2-slim-bookworm | ||
|
|
||
| # Prevent interactive prompts from apt | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # Install system dependencies required for building gems with native extensions | ||
| # and for general development. | ||
| # - build-essential: For compiling native extensions | ||
| # - git: For cloning repos if needed, although VS Code handles the main clone | ||
| # - curl, wget: Useful general tools | ||
| # - libxml2-dev, libxslt1-dev: Needed by nokogiri gem | ||
| # - zlib1g-dev: Needed by many gems | ||
| # - sqlite3, libsqlite3-dev: Needed by some gems that might be transitively included | ||
| # - libssl-dev: Needed for secure connections, potentially by some gems | ||
| # - pkg-config: Build helper | ||
| # - make: Used by the Makefile in the repo | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| git \ | ||
| curl \ | ||
| wget \ | ||
| libxml2-dev \ | ||
| libxslt1-dev \ | ||
| zlib1g-dev \ | ||
| sqlite3 \ | ||
| libsqlite3-dev \ | ||
| libssl-dev \ | ||
| pkg-config \ | ||
| make \ | ||
| zsh \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
Comment on lines
+18
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
|
|
||
| # (Optional but Recommended) Create a non-root user for development | ||
| # This matches the default user setup by Dev Containers 'automatic' creation | ||
| ARG USERNAME=vscode | ||
| ARG USER_UID=1000 | ||
| ARG USER_GID=$USER_UID | ||
|
|
||
| RUN groupadd --gid $USER_GID $USERNAME \ | ||
| && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
| # Add the new user to the sudo group to allow them to run commands with sudo | ||
| && apt-get update \ | ||
| && apt-get install -y sudo \ | ||
| && echo $USERNAME ALL=\(ALL\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
| && chmod 0440 /etc/sudoers.d/$USERNAME \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
Comment on lines
+42
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+42
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| # Set Zsh as the default shell for the non-root user | ||
| # Needs to be run as root, after the user is created and zsh is installed | ||
| RUN chsh -s $(which zsh) ${USERNAME} | ||
|
|
||
| # Set the default working directory for subsequent commands and where the project code will be mounted | ||
| WORKDIR /workspaces | ||
|
|
||
| # Switch to the non-root user | ||
| USER $USERNAME | ||
|
|
||
| # The project code will be mounted into /workspaces by Dev Containers. | ||
| # Dependencies will be installed via postCreateCommand in devcontainer.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // .devcontainer/devcontainer.json | ||
| { | ||
| "name": "Fluent Plugin Datadog Dev", // A friendly name | ||
| // Specify the path to the custom Dockerfile | ||
| "build": { | ||
| "dockerfile": "Dockerfile" | ||
| }, | ||
| // Use the non-root user created in the Dockerfile | ||
| "remoteUser": "vscode", | ||
| // Set the workspace folder inside the container | ||
| "workspaceFolder": "/workspaces/fluent-plugin-datadog", | ||
| // Command to run after the container is created and the workspace is mounted. | ||
| // This installs the gem dependencies using Bundler. | ||
| "postCreateCommand": "bundle install && sh -c \"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\"", | ||
| // Forward ports that might be useful (e.g., for testing Fluentd) | ||
| // Fluentd's default forward port is 24224. The repo's docker-compose also uses this. | ||
| "forwardPorts": [ | ||
| 24224 | ||
| ], | ||
| // Configuration specific to VS Code | ||
| "customizations": { | ||
| "vscode": { | ||
| "settings": { | ||
| // Optional: Configure Ruby environment settings if needed | ||
| "ruby.useBundler": true, | ||
| "ruby.lint": { | ||
| "rubocop": true | ||
| }, | ||
| "ruby.format": "rubocop", | ||
| // Add other Ruby or general settings here | ||
| // Configure VS Code's integrated terminal to use Zsh | ||
| "terminal.integrated.defaultProfile.linux": "zsh (2)", | ||
| "terminal.integrated.profiles.linux": { | ||
| "zsh (2)": { | ||
| "path": "zsh" | ||
| } | ||
| } | ||
| }, | ||
| // Specify VS Code extensions to install automatically | ||
| "extensions": [ | ||
| "rebornix.ruby", // Official Ruby extension | ||
| "bungcip.better-toml", // For TOML config files | ||
| "kaiinui.vscode-ruby-test-explorer", // If you want a test explorer UI | ||
| "dbaeumer.vscode-eslint", // If there are JS parts or linting | ||
| "redhat.vscode-yaml", // For YAML files (like the docker-compose) | ||
| "ms-azuretools.vscode-docker" // Useful for working with Docker inside VS Code | ||
| // Add any other extensions relevant to your workflow | ||
| ] | ||
| } | ||
| } | ||
| // Uncomment to connect as root instead of the remoteUser. | ||
| // "remoteUser": "root" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "Debug Fluentd with Plugin", | ||
| "type": "Ruby", | ||
| "request": "launch", | ||
| "program": "/usr/local/bin/bundle", | ||
| "args": [ | ||
| "exec", | ||
| "fluentd", | ||
| "-c", | ||
| "${workspaceFolder}/test/fluentd-test.conf", | ||
| "-p", | ||
| "${workspaceFolder}/lib/fluent/plugin" | ||
| ], | ||
| "cwd": "${workspaceFolder}", | ||
| "showDebuggerOutput": true, | ||
| "useBundler": true | ||
| }, | ||
| { | ||
| "name": "Debug Rake Tests", | ||
| "type": "Ruby", | ||
| "request": "launch", | ||
| "program": "/usr/local/bin/bundle", | ||
| "args": [ | ||
| "exec", | ||
| "rake", | ||
| "test" | ||
| ], | ||
| "cwd": "${workspaceFolder}", | ||
| "showDebuggerOutput": true, | ||
| "useBundler": true | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "Install Dependencies", | ||
| "type": "shell", | ||
| "command": "bundle install", | ||
| "group": "build", | ||
| "presentation": { | ||
| "reveal": "always", | ||
| "panel": "new" | ||
| }, | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "Build Gem", | ||
| "type": "shell", | ||
| "command": "gem build fluent-plugin-datadog.gemspec", | ||
| "group": { | ||
| "kind": "build", | ||
| "isDefault": true | ||
| }, | ||
| "presentation": { | ||
| "reveal": "always", | ||
| "panel": "new" | ||
| }, | ||
| "problemMatcher": [], | ||
| "dependsOn": ["Install Dependencies"] | ||
| }, | ||
| { | ||
| "label": "Run Tests", | ||
| "type": "shell", | ||
| "command": "bundle exec rake test", | ||
| "group": "test", | ||
| "presentation": { | ||
| "reveal": "always", | ||
| "panel": "new" | ||
| }, | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "Build and Test", | ||
| "dependsOn": [ | ||
| "Install Dependencies", | ||
| "Build Gem", | ||
| "Run Tests" | ||
| ], | ||
| "group": { | ||
| "kind": "build", | ||
| "isDefault": false | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
⚪ Code Quality Violation
package libsqlite3-dev should have version pinned (...read more)
When using
apt-get install, pin the version to avoid unwanted upgrades and undefined behavior.