Skip to content
Open
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
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,26 @@ See [packagingtest/](packagingtest/)

# How To Build Theses Containers (developer)

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


``` shell
cd st2packaging-dockerfiles/packagingbuild/focal
docker build -t stackstorm/packagingbuild:focal .
# ./build_image
Usage ./build_image <bootstrap|build [distro]>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably worth mentioning what OS this build_image works on, as it looks to be deb only, I couldn't run this on my mac

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ./build_image build jammy command should work on any *nix distro that has docker installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a note about bootstrap only supporting Ubuntu.


bootstrap - Configure the system with the Docker repository and
install Docker CE and Docker Compose packages.
build [distro] - Build the Docker images for the given distro codename.
Builds all distros when no codename provided.

# ./build_image build focal
```

Or by invoking docker directly

cd st2packaging-dockerfiles/packagingtest/focal
docker build -t stackstorm/packagingtest:focal .
```
export TGT=noble
cd st2packaging-dockerfiles/packagingtest
docker build -f $TGT/Dockefile -t stackstorm/packagingtest:$TGT .
```
13 changes: 0 additions & 13 deletions bootstrap.sh

This file was deleted.

17 changes: 0 additions & 17 deletions build_all.sh

This file was deleted.

78 changes: 78 additions & 0 deletions build_image
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash

set -e +x -o pipefail

function bootstrap_docker()
{
sudo apt-get update --quiet --quiet
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common jq

export CODENAME=$(source /etc/os-release && echo "$VERSION_CODENAME")
export DISTRO=$(source /etc/os-release && echo "$ID")
export ARCH=$(dpkg --print-architecture)
# get gpg key for download.docker
curl -fsSL https://download.docker.com/linux/${DISTRO}/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/download.docker.gpg
sudo tee <<<"deb [arch=${ARCH}] https://download.docker.com/linux/${DISTRO} ${CODENAME} stable" /etc/apt/sources.list.d/download.docker.list
sudo apt update --quiet --quiet
sudo apt install docker-ce docker-ce-cli docker-compose-plugin
sudo usermod -a -G docker vagrant
}

function build()
{
local CODENAME="$1"

date_suffix=$(date +%Y-%m-%d)

echo "Building packagingbuild image..."
(docker build --progress plain -f "packagingbuild/${CODENAME}/Dockerfile" -t "stackstorm/packagingbuild:${CODENAME}" -t "stackstorm/packagingbuild:${CODENAME}-${date_suffix}" .) || exit -1

echo "Building packagingtest image..."
(docker build --progress plain -f "packagingtest/${CODENAME}/Dockerfile" -t "stackstorm/packagingtest:${CODENAME}" -t "stackstorm/packagingtest:${CODENAME}-${date_suffix}" .) || exit -1
}

function build_target()
{
local CODENAME="$1"
for DOCKERFILE in packagingbuild/$CODENAME/Dockerfile
do
TARGET_PATH=$(dirname $DOCKERFILE)
TARGET=$(basename $TARGET_PATH)
build $TARGET
done
}

function usage()
{
cat <<EOF
Usage $0 <bootstrap|build [distro]>

bootstrap - Configure the system with the Docker repository and
install Docker CE and Docker Compose packages. (Ubuntu only)
build [distro] - Build the Docker images for the given distro codename.
Builds all distros when no codename provided.

EOF
}

if [[ $# -eq 0 ]]; then
usage
exit 1
fi

case "$1" in
"bootstrap")
bootstrap_docker
;;
"build")
if [[ -n "$2" ]]; then
build_target "$2"
else
build_target '*'
fi
;;
*)
usage
exit 1
;;
esac
14 changes: 0 additions & 14 deletions build_one.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
Loading