Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·93 lines (79 loc) · 2.75 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·93 lines (79 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
#
# Builds the lmndev-runner Docker image(s) locally.
# Calls collect-deps.sh and then builds the image(s).
#
# Usage: ./build.sh [--no-collect] [<ubuntu-version>|all]
# --no-collect Do not regenerate deps.txt and linuxmuster-common.deb
# <ubuntu-version> Build for a specific Ubuntu version (e.g. 24.04, 26.04)
# all Build all versions defined in UBUNTU_VERSIONS (config)
# Default: build UBUNTU_VERSION from config
#
# thomas@linuxmuster.net
# 20260427
#
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
. ./config
NO_COLLECT=false
BUILD_TARGET=""
for arg in "$@"; do
case "$arg" in
--no-collect) NO_COLLECT=true ;;
*) BUILD_TARGET="$arg" ;;
esac
done
# Determine list of versions to build
if [ "$BUILD_TARGET" = "all" ]; then
VERSIONS="$UBUNTU_VERSIONS"
elif [ -n "$BUILD_TARGET" ]; then
VERSIONS="$BUILD_TARGET"
else
VERSIONS="$UBUNTU_VERSION"
fi
echo "=== lmndev-runner Build ==="
echo " Versions: ${VERSIONS}"
echo " Image: ${IMAGE_NAME}"
echo " Shell: ${DEFAULT_SHELL}"
[ -n "$EXTRA_PACKAGES" ] && echo " Extras: ${EXTRA_PACKAGES}"
echo ""
# Collect dependencies once (shared across all versions)
if [ "$NO_COLLECT" = false ]; then
bash "$SCRIPT_DIR/collect-deps.sh"
echo ""
else
echo "--- Skipping collect-deps.sh (--no-collect)"
[ -f deps.txt ] || { echo "ERROR: deps.txt not found."; exit 1; }
[ -f linuxmuster-common.deb ] || { echo "ERROR: linuxmuster-common.deb not found."; exit 1; }
fi
EXTRA_PACKAGES_ARGS=()
[ -n "${EXTRA_PACKAGES}" ] && EXTRA_PACKAGES_ARGS=(--build-arg "EXTRA_PACKAGES=${EXTRA_PACKAGES}")
for VERSION in $VERSIONS; do
# Check availability, fall back to UBUNTU_FALLBACK if needed
UBUNTU_TAG="$VERSION"
if ! docker pull "ubuntu:${VERSION}" >/dev/null 2>&1; then
echo "WARNING: ubuntu:${VERSION} not available, using fallback: ${UBUNTU_FALLBACK}"
UBUNTU_TAG="$UBUNTU_FALLBACK"
fi
# Version-specific tags
EXTRA_TAGS=(-t "${IMAGE_NAME}:${VERSION}" -t "${GHCR_IMAGE}:${VERSION}")
# Primary version also gets :latest
if [ "$VERSION" = "$UBUNTU_VERSION" ]; then
EXTRA_TAGS+=(-t "${IMAGE_NAME}:latest" -t "${GHCR_IMAGE}:latest")
fi
echo "--- Building Docker image for Ubuntu ${VERSION} ..."
docker build \
--build-arg UBUNTU_VERSION="${UBUNTU_TAG}" \
--build-arg DEFAULT_SHELL="${DEFAULT_SHELL}" \
"${EXTRA_PACKAGES_ARGS[@]}" \
--build-arg MY_USER="${MY_USER}" \
--build-arg MY_UID="${MY_UID}" \
--build-arg MY_GID="${MY_GID}" \
"${EXTRA_TAGS[@]}" \
.
echo "--- Done: ${IMAGE_NAME}:${VERSION}"
echo ""
done
rm -f deps.txt linuxmuster-common.deb
echo "=== All images built ==="