-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·48 lines (32 loc) · 1.68 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·48 lines (32 loc) · 1.68 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
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# All variables come from environment
BASE_IMAGE=${BASE_IMAGE:?required}
IMAGE_NAME=${IMAGE_NAME:?required}
IMAGE_VERSION=${IMAGE_VERSION:?required}
FINAL_IMAGE="localhost/${IMAGE_NAME}:latest"
echo "==> Building container from $BASE_IMAGE to $FINAL_IMAGE (IMAGE_NAME: $IMAGE_NAME, IMAGE_VERSION: $IMAGE_VERSION)"
TEMP_IMAGE="localhost/pureblue:building-$$"
echo "==> Building cleanup layer"
podman build --build-arg BASE_IMAGE="$BASE_IMAGE" -f Containerfile.cleanup -t "$TEMP_IMAGE" .
echo "==> Building flatpaks layer"
"$SCRIPT_DIR/flatpak/build-repo.sh" "$TEMP_IMAGE" "$TEMP_IMAGE"
echo "==> Building packages layer"
podman build --build-arg BASE_IMAGE="$TEMP_IMAGE" -f Containerfile.packages -t "$TEMP_IMAGE" .
echo "==> Building extensions layer"
podman build --build-arg BASE_IMAGE="$TEMP_IMAGE" -f Containerfile.extensions -t "$TEMP_IMAGE" .
echo "==> Building tweaks layer"
podman build --build-arg BASE_IMAGE="$TEMP_IMAGE" -f Containerfile.tweaks -t "$TEMP_IMAGE" .
echo "==> Building services layer"
podman build --build-arg BASE_IMAGE="$TEMP_IMAGE" -f Containerfile.services -t "$TEMP_IMAGE" .
echo "==> Building final layer"
podman build --build-arg BASE_IMAGE="$TEMP_IMAGE" -f Containerfile.final -t "$TEMP_IMAGE" .
echo "==> Building brand layer"
podman build --build-arg BASE_IMAGE="$TEMP_IMAGE" --build-arg IMAGE_NAME="$IMAGE_NAME" --build-arg IMAGE_VERSION="$IMAGE_VERSION" -f Containerfile.brand -t "$TEMP_IMAGE" .
# Tag final image
echo "==> Tagging as $FINAL_IMAGE"
podman tag "$TEMP_IMAGE" "$FINAL_IMAGE"
# Clean up temp tag
podman rmi "$TEMP_IMAGE" || true
echo "==> Build complete: $FINAL_IMAGE"