forked from open-telemetry/opentelemetry-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
965 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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 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,58 @@ | ||
# Customizing Your Dev Container | ||
|
||
Customize your dev container using build arguments (for direct Docker builds) or | ||
environment variables (for evaluation in `devcontainer.json`). | ||
|
||
* **CXX standard:** | ||
This is the C++ standard to build from (eg: 17, 20, ...). (Default: 17) | ||
* Docker ARG: | ||
`CXX_STANDARD` | ||
* Host Environment Variable: | ||
`OTEL_CPP_DEVCONTAINER_CXX_STANDARD` | ||
|
||
* **abseil-cpp version:** | ||
This is the version of abseil-cpp that will be used to build protobuf, gRPC, | ||
and opentelemetry-cpp (when WITH_ABSEIL is set). | ||
* Docker ARG: | ||
`ABSEIL_CPP_VERSION` | ||
* Host Environment Variable: | ||
`OTEL_CPP_DEVCONTAINER_ABSEIL_CPP_VERSION` | ||
|
||
* **Protobuf version:** | ||
* Docker ARG: | ||
`PROTOBUF_VERSION` | ||
* Host Environment Variable: | ||
`OTEL_CPP_DEVCONTAINER_PROTOBUF_VERSION` | ||
|
||
* **gRPC version:** | ||
* Docker ARG: | ||
`GRPC_VERSION` | ||
* Host Environment Variable: | ||
`OTEL_CPP_DEVCONTAINER_GRPC_VERSION` | ||
|
||
* **User ID (UID):** | ||
User ID (Default: `1000`) | ||
* Docker ARG: | ||
`USER_UID` | ||
* Host Environment Variable: | ||
`OTEL_CPP_DEVCONTAINER_USER_UID` | ||
|
||
* **Group ID (GID):** | ||
User group ID (Default: `1000`) | ||
* Docker ARG: | ||
`USER_GID` | ||
* Host Environment Variable: | ||
`OTEL_CPP_DEVCONTAINER_USER_GID` | ||
|
||
* **Install Packages:** | ||
These are the additional packages that will be installed via `apt install` in the devcontainer. This is a space separated list. | ||
* Docker ARG: | ||
`INSTALL_PACKAGES` (Default: ``) | ||
* Host Environment Variable: | ||
`OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES` (Default: ``) | ||
|
||
## Examples | ||
|
||
* `docker build --build-arg CXX_STANDARD="20" --build-arg INSTALL_PACKAGES="nano gitk"...` | ||
* `export OTEL_CPP_DEVCONTAINER_CXX_STANDARD=20` | ||
* `export OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES="nano gitk"` |
This file contains 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,39 @@ | ||
#!/bin/bash | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -eu | ||
|
||
if [[ $IS_CONTAINER_BUILD != "true" ]]; then | ||
echo "This script should only run inside a Docker container." | ||
exit 1 | ||
fi | ||
|
||
if [[ -n "$INSTALL_PACKAGES" ]]; then | ||
packages=($INSTALL_PACKAGES) | ||
for package in "${packages[@]}"; do | ||
apt install -y "$package" | ||
done | ||
fi | ||
|
||
if [[ $(id "$USER_NAME" 2>/dev/null) ]]; then | ||
echo "User '$USER_NAME' already exists. Removing it." | ||
userdel -rf "$USER_NAME" | ||
elif [[ $(id -u "$USER_UID" 2>/dev/null) ]]; then | ||
OTHER_USER=$(getent passwd "$USER_UID" | cut -d: -f1) | ||
echo "User '$OTHER_USER' exists with UID $USER_UID. Removing it." | ||
userdel -rf "$OTHER_USER" | ||
fi | ||
|
||
if [[ ! $(getent group "$USER_GID" 2>/dev/null) ]]; then | ||
echo "Group '$USER_GID' does not exist. Adding it." | ||
groupadd -g "$USER_GID" "$USER_NAME" | ||
fi | ||
|
||
useradd -m -u "$USER_UID" -g "$USER_GID" -s /bin/bash "$USER_NAME" | ||
echo "Created user '$USER_NAME' (UID: $USER_UID, GID: $USER_GID)." | ||
|
||
echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/"$USER_NAME" | ||
|
||
echo "User and group setup complete." |
This file contains 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 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 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 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 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 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.