Skip to content

Add devcontainer configuration and initialization scripts #507

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

Merged
merged 2 commits into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM mcr.microsoft.com/devcontainers/java:1-21-bullseye

ENV MAVEN_CONFIG=/var/maven/.m2

# [Optional] Uncomment if you want to install more tools
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends maven \
&& mkdir -p /var/maven/.m2 \
&& chown -R vscode:vscode /var/maven/.m2
5 changes: 5 additions & 0 deletions .devcontainer/commands/initialize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

git config --local user.name "$(git config user.name)"
git config --local user.email "$(git config user.email)"
Comment on lines +4 to +5
Copy link
Preview

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using set -e combined with direct git config calls will cause the script to exit if user.name or user.email aren't set. Consider using git config --get with a conditional or default value to avoid breaking initialization.

Suggested change
git config --local user.name "$(git config user.name)"
git config --local user.email "$(git config user.email)"
user_name=$(git config --get user.name || echo "Default User")
user_email=$(git config --get user.email || echo "[email protected]")
git config --local user.name "$user_name"
git config --local user.email "$user_email"

Copilot uses AI. Check for mistakes.

35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/java
{
"name": "YDB Java SDK",
"dockerFile": "Dockerfile",
// Allows the container to use ptrace, which is useful for debugging.
"capAdd": [
"SYS_PTRACE"
],
// Disables seccomp, which can be necessary for some debugging tools to function correctly.
"securityOpt": [
"seccomp=unconfined"
],
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
// Use 'initializeCommand' to run commands before the container is created.
"initializeCommand": "chmod +x .devcontainer/commands/initialize.sh && .devcontainer/commands/initialize.sh",
// Use 'postCreateCommand' to run commands after the container is created.
// Use 'postStartCommand' to run commands after the container is started.
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"redhat.java",
"vscjava.vscode-java-pack"
]
}
},
// Maven cache volume configuration.
"mounts": [
"source=maven-cache,target=/var/maven/.m2,type=volume"
]
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
**/.idea/
**/*.iml
**/*.iws
**/*.ipr
**/*.ipr

# VS Code
.vscode