Skip to content
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

feat: add devcontainer #2131

Merged
merged 3 commits into from
Jan 12, 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
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
Loading