Skip to content

Commit 62036bb

Browse files
authored
Merge pull request #126 from nzlosh/refactor
Refactor build structure and add noble.
2 parents 37fff52 + a69aa59 commit 62036bb

43 files changed

Lines changed: 677 additions & 1033 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,26 @@ See [packagingtest/](packagingtest/)
1919

2020
# How To Build Theses Containers (developer)
2121

22-
If you're a developer looking to modify / test / build these containers simply, change into
23-
the container's directory and do the following:
22+
If you're a developer looking to modify / test / build these containers a convenience script `build_image` can
23+
be used to setup docker and build the docker images.
24+
2425

2526
``` shell
26-
cd st2packaging-dockerfiles/packagingbuild/focal
27-
docker build -t stackstorm/packagingbuild:focal .
27+
# ./build_image
28+
Usage ./build_image <bootstrap|build [distro]>
29+
30+
bootstrap - Configure the system with the Docker repository and
31+
install Docker CE and Docker Compose packages.
32+
build [distro] - Build the Docker images for the given distro codename.
33+
Builds all distros when no codename provided.
34+
35+
# ./build_image build focal
36+
```
37+
38+
Or by invoking docker directly
2839

29-
cd st2packaging-dockerfiles/packagingtest/focal
30-
docker build -t stackstorm/packagingtest:focal .
40+
```
41+
export TGT=noble
42+
cd st2packaging-dockerfiles/packagingtest
43+
docker build -f $TGT/Dockefile -t stackstorm/packagingtest:$TGT .
3144
```

bootstrap.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

build_all.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

build_image

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/bash
2+
3+
set -e +x -o pipefail
4+
5+
function bootstrap_docker()
6+
{
7+
sudo apt-get update --quiet --quiet
8+
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common jq
9+
10+
export CODENAME=$(source /etc/os-release && echo "$VERSION_CODENAME")
11+
export DISTRO=$(source /etc/os-release && echo "$ID")
12+
export ARCH=$(dpkg --print-architecture)
13+
# get gpg key for download.docker
14+
curl -fsSL https://download.docker.com/linux/${DISTRO}/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/download.docker.gpg
15+
sudo tee <<<"deb [arch=${ARCH}] https://download.docker.com/linux/${DISTRO} ${CODENAME} stable" /etc/apt/sources.list.d/download.docker.list
16+
sudo apt update --quiet --quiet
17+
sudo apt install docker-ce docker-ce-cli docker-compose-plugin
18+
sudo usermod -a -G docker vagrant
19+
}
20+
21+
function build()
22+
{
23+
local CODENAME="$1"
24+
25+
date_suffix=$(date +%Y-%m-%d)
26+
27+
echo "Building packagingbuild image..."
28+
(docker build --progress plain -f "packagingbuild/${CODENAME}/Dockerfile" -t "stackstorm/packagingbuild:${CODENAME}" -t "stackstorm/packagingbuild:${CODENAME}-${date_suffix}" .) || exit -1
29+
30+
echo "Building packagingtest image..."
31+
(docker build --progress plain -f "packagingtest/${CODENAME}/Dockerfile" -t "stackstorm/packagingtest:${CODENAME}" -t "stackstorm/packagingtest:${CODENAME}-${date_suffix}" .) || exit -1
32+
}
33+
34+
function build_target()
35+
{
36+
local CODENAME="$1"
37+
for DOCKERFILE in packagingbuild/$CODENAME/Dockerfile
38+
do
39+
TARGET_PATH=$(dirname $DOCKERFILE)
40+
TARGET=$(basename $TARGET_PATH)
41+
build $TARGET
42+
done
43+
}
44+
45+
function usage()
46+
{
47+
cat <<EOF
48+
Usage $0 <bootstrap|build [distro]>
49+
50+
bootstrap - Configure the system with the Docker repository and
51+
install Docker CE and Docker Compose packages. (Ubuntu only)
52+
build [distro] - Build the Docker images for the given distro codename.
53+
Builds all distros when no codename provided.
54+
55+
EOF
56+
}
57+
58+
if [[ $# -eq 0 ]]; then
59+
usage
60+
exit 1
61+
fi
62+
63+
case "$1" in
64+
"bootstrap")
65+
bootstrap_docker
66+
;;
67+
"build")
68+
if [[ -n "$2" ]]; then
69+
build_target "$2"
70+
else
71+
build_target '*'
72+
fi
73+
;;
74+
*)
75+
usage
76+
exit 1
77+
;;
78+
esac

build_one.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)