Skip to content

Commit

Permalink
feat: add devcontainer (#2131)
Browse files Browse the repository at this point in the history
  • Loading branch information
GarciaLnk authored Jan 12, 2025
1 parent 0ec97db commit ce84b9d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "Bluefin-devcontainer",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"workspaceFolder": "${localWorkspaceFolder}",
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind",
"mounts": [{ "source": "/tmp", "target": "/tmp", "type": "bind" }],
"otherPortsAttributes": { "onAutoForward" : "ignore" },
"customizations": {
"vscode": {
"extensions": [
"eamodio.gitlens",
"hangxingliu.vscode-systemd-support",
"mads-hartmann.bash-ide-vscode",
"ms-azuretools.vscode-docker",
"sclu1034.justfile",
"timonwong.shellcheck"
]
}
},
// Likely need to add "--userns=keep-id, --group-add=keep-groups" for podman support
"runArgs": ["--init"],
"securityOpt": [
"label=disable"
],
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/guiyomh/features/just:0": {},
"ghcr.io/lukewiwa/features/shellcheck:0": {},
"ghcr.io/jsburckhardt/devcontainer-features/skopeo:1": {}
},
"onCreateCommand": {
"bash-completions": "sudo apt-get install -y bash-completion; echo 'source /etc/profile.d/bash_completion.sh' | sudo tee -a /etc/bash.bashrc > /dev/null",
"just-completions": "just --completions bash | sudo tee -a /etc/bash_completion.d/just > /dev/null",
"docker-completions": "docker completion bash | sudo tee -a /etc/bash_completion.d/docker.sh > /dev/null"
}
}
11 changes: 6 additions & 5 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tags := '(
export SUDO_DISPLAY := if `if [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; then echo true; fi` == "true" { "true" } else { "false" }
export SUDOIF := if `id -u` == "0" { "" } else { if SUDO_DISPLAY == "true" { "sudo --askpass" } else { "sudo" } }
export PODMAN := if path_exists("/usr/bin/podman") == "true" { env("PODMAN", "/usr/bin/podman") } else { if path_exists("/usr/bin/docker") == "true" { env("PODMAN", "docker") } else { env("PODMAN", "exit 1 ; ") } }
export PULL_POLICY := if PODMAN =~ "docker" { "missing" } else { "newer" }

[private]
default:
Expand Down Expand Up @@ -226,7 +227,7 @@ build $image="bluefin" $tag="latest" $flavor="main" rechunk="0" ghcr="0" pipelin
"${BUILD_ARGS[@]}" \
"${LABELS[@]}" \
--target "${target}" \
--tag "${image_name}:${tag}" \
--tag localhost/"${image_name}:${tag}" \
--file Containerfile \
.
echo "::endgroup::"
Expand Down Expand Up @@ -346,7 +347,7 @@ rechunk $image="bluefin" $tag="latest" $flavor="main" ghcr="0" pipeline="0":

# Run Rechunker's Prune
${SUDOIF} ${PODMAN} run --rm \
--pull=newer \
--pull=${PULL_POLICY} \
--security-opt label=disable \
--volume "$MOUNT":/var/tree \
--env TREE=/var/tree \
Expand Down Expand Up @@ -379,7 +380,7 @@ rechunk $image="bluefin" $tag="latest" $flavor="main" ghcr="0" pipeline="0":

# Run Rechunker
${SUDOIF} ${PODMAN} run --rm \
--pull=newer \
--pull=${PULL_POLICY} \
--security-opt label=disable \
--volume "$PWD:/workspace" \
--volume "$PWD:/var/git" \
Expand Down Expand Up @@ -559,7 +560,7 @@ build-iso $image="bluefin" $tag="latest" $flavor="main" ghcr="0" pipeline="0":

# Build ISO
iso_build_args=()
iso_build_args+=("--rm" "--privileged" "--pull=newer")
iso_build_args+=("--rm" "--privileged" "--pull=${PULL_POLICY}")
if [[ "{{ ghcr }}" == "0" ]]; then
iso_build_args+=(--volume "/var/lib/containers/storage:/var/lib/containers/storage")
fi
Expand Down Expand Up @@ -620,7 +621,7 @@ run-iso $image="bluefin" $tag="latest" $flavor="main":
echo "Connect to http://localhost:${port}"
run_args=()
run_args+=(--rm --privileged)
run_args+=(--pull=newer)
run_args+=(--pull=${PULL_POLICY})
run_args+=(--publish "127.0.0.1:${port}:8006")
run_args+=(--env "CPU_CORES=4")
run_args+=(--env "RAM_SIZE=8G")
Expand Down

0 comments on commit ce84b9d

Please sign in to comment.