Continue work on builder

- add conditional proxy support
- use xargs to parallelize image builds
- some tweaking and notes
This commit is contained in:
t3chn0m4g3
2024-09-07 00:35:04 +00:00
parent acf09bc160
commit 024d79d001
10 changed files with 123 additions and 25 deletions

View File

@ -19,6 +19,10 @@ TPOT_GHCR_REPO=ghcr.io/telekom-security
TPOT_VERSION=testing
# T-Pot platforms (architectures)
# Most docker features are available on linux
# Most docker features are available on linux
TPOT_AMD64=linux/amd64
TPOT_ARM64=linux/arm64
# Proxy
# Set Proxy (i.e. "http://proxy:3128") to improve speed (while caching)
# PROXY="http://proxy:3128"

19
docker/_builder/builder.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
# ANSI color codes for green (OK) and red (FAIL)
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# List of services to build
services="adbhoney nginx map"
#test=$(docker compose config --services)
#echo $test
# Loop through each service
echo $services | tr ' ' '\n' | xargs -I {} -P 3 bash -c '
echo "Building service: {}" && \
docker compose build {} --no-cache 2>&1 > {}.log && \
echo -e "Service {}: [\033[0;32mOK\033[0m]" || \
echo -e "Service {}: [\033[0;31mFAIL\033[0m]"
'

View File

@ -7,6 +7,8 @@
# Common build config
x-common-build: &common-build
args:
PROXY: ${PROXY}
dockerfile: ./Dockerfile
platforms:
- ${TPOT_AMD64}

View File

@ -39,15 +39,19 @@ echo "Docs: https://docs.docker.com/desktop/multi-arch/"
echo
echo "Example (build release): docker compose build"
echo
echo "Example (push release): docker compose build --push"
echo "Example (build and push release): docker compose build --push"
echo
echo "Example (build single image): docker compose build tpotinit"
echo
echo "Example (build and push single image): docker compose build tpotinit --push"
echo
echo "Resolve problems running ..."
echo "Resolve problems running buildx:"
echo "docker buildx create --use --name mybuilder"
echo "docker buildx inspect mybuilder --bootstrap"
echo "docker login -u <username>"
echo "docker login ghcr.io - <username>"
echo
echo "Resolve segmentation faults when building arm64 images in qemu on amd64:"
echo "docker run --rm --privileged multiarch/qemu-user-static --reset -p yes"
echo