From 4d1667529551c69d230691eb4204f64bb916e84d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garc=C3=ADa?= <4411661+GarciaLnk@users.noreply.github.com> Date: Thu, 9 Jan 2025 19:24:40 +0000 Subject: [PATCH 1/3] fix: always tag built image to localhost in docker, images are tagged to docker.io by default, this makes the behaviour consistent with podman, where localhost is used instead --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index 04744c3139b..df76ce2244a 100644 --- a/Justfile +++ b/Justfile @@ -226,7 +226,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::" From a7139792d63f8fcc5434b1ba2765cdf08f667049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garc=C3=ADa?= <4411661+GarciaLnk@users.noreply.github.com> Date: Thu, 9 Jan 2025 19:51:26 +0000 Subject: [PATCH 2/3] fix: define pull policy for docker fallback to 'missing' since podman's 'newer' is not available in docker --- Justfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Justfile b/Justfile index df76ce2244a..08486315f45 100644 --- a/Justfile +++ b/Justfile @@ -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: @@ -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 \ @@ -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" \ @@ -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 @@ -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") From 57b3e3ddb24faf5454c577df694ccc1b70c35a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garc=C3=ADa?= <4411661+GarciaLnk@users.noreply.github.com> Date: Thu, 9 Jan 2025 22:37:36 +0000 Subject: [PATCH 3/3] feat: add devcontainer tested working recipes in devcontainer: * just build * just run * just build-iso * just run-iso --- .devcontainer/devcontainer.json | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..a2ba9d90a91 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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" + } +}