Skip to content

Commit a2ca958

Browse files
committed
Add devcontainers.
1 parent 3336c0d commit a2ca958

File tree

8 files changed

+190
-0
lines changed

8 files changed

+190
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ComplianceAsCode Dev (Ubuntu+Fedora)",
3+
"image": "ghcr.io/ggbecker/cac-dev:latest",
4+
5+
"features": {
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
7+
},
8+
9+
"postCreateCommand": "bash utils/setup_dev.sh fedora",
10+
11+
// Configure tool-specific properties.
12+
"customizations": {
13+
"vscode":{
14+
"extensions": [
15+
"ggbecker.content-navigator", // useful extension for the ComplianceAsCode/content project
16+
"ms-vscode.live-server", // HTML preview
17+
"rogalmic.bash-debug", // support bashdb debug configurations
18+
"eamodio.gitlens", // cool git extension with a bunch of extra features
19+
"twxs.cmake", // support to CMakeLists.txt syntax highlighting and more
20+
"ms-python.python" // running python configurations
21+
]
22+
}
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ComplianceAsCode Dev (Ubuntu+RHEL)",
3+
"image": "ghcr.io/ggbecker/cac-dev:latest",
4+
5+
"features": {
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
7+
},
8+
9+
"postCreateCommand": "bash utils/setup_dev.sh rhel9",
10+
11+
// Configure tool-specific properties.
12+
"customizations": {
13+
"vscode":{
14+
"extensions": [
15+
"ggbecker.content-navigator", // useful extension for the ComplianceAsCode/content project
16+
"ms-vscode.live-server", // HTML preview
17+
"rogalmic.bash-debug", // support bashdb debug configurations
18+
"eamodio.gitlens", // cool git extension with a bunch of extra features
19+
"twxs.cmake", // support to CMakeLists.txt syntax highlighting and more
20+
"ms-python.python" // running python configurations
21+
]
22+
}
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ComplianceAsCode Workshop Exercise 1",
3+
"image": "ghcr.io/ggbecker/cac-dev:latest",
4+
5+
"features": {
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
7+
},
8+
9+
"postCreateCommand": "bash utils/setup_dev.sh fedora lab1_introduction",
10+
11+
// Configure tool-specific properties.
12+
"customizations": {
13+
"vscode":{
14+
"extensions": [
15+
"ggbecker.content-navigator", // useful extension for the ComplianceAsCode/content project
16+
"ms-vscode.live-server", // HTML preview
17+
"rogalmic.bash-debug", // support bashdb debug configurations
18+
"eamodio.gitlens", // cool git extension with a bunch of extra features
19+
"twxs.cmake", // support to CMakeLists.txt syntax highlighting and more
20+
"ms-python.python" // running python configurations
21+
]
22+
}
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ComplianceAsCode Workshop Exercise 2",
3+
"image": "ghcr.io/ggbecker/cac-dev:latest",
4+
5+
"features": {
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
7+
},
8+
9+
"postCreateCommand": "bash utils/setup_dev.sh fedora lab2_openscap",
10+
11+
// Configure tool-specific properties.
12+
"customizations": {
13+
"vscode":{
14+
"extensions": [
15+
"ggbecker.content-navigator", // useful extension for the ComplianceAsCode/content project
16+
"ms-vscode.live-server", // HTML preview
17+
"rogalmic.bash-debug", // support bashdb debug configurations
18+
"eamodio.gitlens", // cool git extension with a bunch of extra features
19+
"twxs.cmake", // support to CMakeLists.txt syntax highlighting and more
20+
"ms-python.python" // running python configurations
21+
]
22+
}
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ComplianceAsCode Workshop Exercise 3",
3+
"image": "ghcr.io/ggbecker/cac-dev:latest",
4+
5+
"features": {
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
7+
},
8+
9+
"postCreateCommand": "bash utils/setup_dev.sh fedora lab3_profiles",
10+
11+
// Configure tool-specific properties.
12+
"customizations": {
13+
"vscode":{
14+
"extensions": [
15+
"ggbecker.content-navigator", // useful extension for the ComplianceAsCode/content project
16+
"ms-vscode.live-server", // HTML preview
17+
"rogalmic.bash-debug", // support bashdb debug configurations
18+
"eamodio.gitlens", // cool git extension with a bunch of extra features
19+
"twxs.cmake", // support to CMakeLists.txt syntax highlighting and more
20+
"ms-python.python" // running python configurations
21+
]
22+
}
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ComplianceAsCode Workshop Exercise 4",
3+
"image": "ghcr.io/ggbecker/cac-dev:latest",
4+
5+
"features": {
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
7+
},
8+
9+
"postCreateCommand": "bash utils/setup_dev.sh fedora lab4_ansible",
10+
11+
// Configure tool-specific properties.
12+
"customizations": {
13+
"vscode":{
14+
"extensions": [
15+
"ggbecker.content-navigator", // useful extension for the ComplianceAsCode/content project
16+
"ms-vscode.live-server", // HTML preview
17+
"rogalmic.bash-debug", // support bashdb debug configurations
18+
"eamodio.gitlens", // cool git extension with a bunch of extra features
19+
"twxs.cmake", // support to CMakeLists.txt syntax highlighting and more
20+
"ms-python.python" // running python configurations
21+
]
22+
}
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ComplianceAsCode Workshop Exercise 5",
3+
"image": "ghcr.io/ggbecker/cac-dev:latest",
4+
5+
"features": {
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
7+
},
8+
9+
"postCreateCommand": "bash utils/setup_dev.sh fedora lab5_oval",
10+
11+
// Configure tool-specific properties.
12+
"customizations": {
13+
"vscode":{
14+
"extensions": [
15+
"ggbecker.content-navigator", // useful extension for the ComplianceAsCode/content project
16+
"ms-vscode.live-server", // HTML preview
17+
"rogalmic.bash-debug", // support bashdb debug configurations
18+
"eamodio.gitlens", // cool git extension with a bunch of extra features
19+
"twxs.cmake", // support to CMakeLists.txt syntax highlighting and more
20+
"ms-python.python" // running python configurations
21+
]
22+
}
23+
}
24+
}

utils/setup_dev.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
PRODUCT=$1 # parameter passed from .devcontainer.json files
3+
WORKSHOP=$2 # parameter passed from .devcontainer.json files
4+
[ -z "$PRODUCT" ] && PRODUCT="fedora"
5+
[ -z "$CONTAINER" ] && CONTAINER=$PRODUCT
6+
[ -z "$CONTAINER_VERSION" ] && CONTAINER_VERSION="$CONTAINER"
7+
mkdir -p .vscode && cp .gitpod.launch.json .vscode/launch.json
8+
CONTAINER_NAME=${CONTAINER}_container
9+
sed -i "s/&&CONTAINER_NAME&&/$CONTAINER_NAME/g" .vscode/launch.json
10+
sed -i "s/&&DEFAULT_PRODUCT&&/$PRODUCT/g" .vscode/launch.json
11+
PRIVATE_KEY_FOLDER=.ssh
12+
PRIVATE_KEY_FILEPATH=$PRIVATE_KEY_FOLDER/id_rsa
13+
sed -i "s,&&PRIVATE_KEY_FILEPATH&&,$PRIVATE_KEY_FILEPATH,g" .vscode/launch.json
14+
mkdir -p $PRIVATE_KEY_FOLDER
15+
ssh-keygen -N '' -f $PRIVATE_KEY_FILEPATH
16+
# set correct SSH permissions
17+
chmod 600 $PRIVATE_KEY_FILEPATH
18+
docker build --build-arg "CLIENT_PUBLIC_KEY=$(cat $PRIVATE_KEY_FILEPATH.pub)" -t $CONTAINER_NAME --build-arg IMAGE=$CONTAINER_VERSION -f Dockerfiles/test_suite-$CONTAINER .
19+
[ -n "$WORKSHOP" ] && ansible-playbook -i 127.0.0.1, docs/workshop/labs_setup.yml -e EXERCISE="$WORKSHOP" -e LAB_DIR="$(pwd)" --connection=local -u vscode --ssh-extra-args '-F docs/workshop/data/ssh_config'
20+
[ -z "$WORKSHOP" ] && ./build_product $PRODUCT --datastream-only
21+
22+
exit 0

0 commit comments

Comments
 (0)