Skip to content

Commit

Permalink
Use rather than $ to reference variables in scripts; improve comments…
Browse files Browse the repository at this point in the history
… in Dockerfiles.
  • Loading branch information
andream16 committed Sep 11, 2024
1 parent 3862876 commit c9b077f
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ PROTOC=protoc
# https://docs.docker.com/build/building/multi-platform/
# Make sure to always build containers using AMD64 but allow to be overridden by users if need for cross-os compatibility.
CONTAINER_OS_ARCH=linux/amd64
# Allow to independently customise go OS and ARCH flags independently and following the standard practices.
# Allow to independently customise go OS and ARCH flags.
# Defaulting to linux/amd64 as per CONTAINER_OS_ARCH.
GOOS=linux
GOARCH=amd64
Expand Down
4 changes: 3 additions & 1 deletion components/consumers/dependency-track/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ CONTAINER_REPO=
DRACON_VERSION=
SOURCE_CODE_REPO=
PRODUCER_AGGREGATOR_BASE_IMAGE=$(shell test -e .custom_image && cat .custom_image || echo "scratch")
# https://docs.docker.com/build/building/multi-platform/
# Make sure to always build containers using AMD64 but allow to be overridden by users if need for cross-os compatibility.
CONTAINER_OS_ARCH=linux/amd64
# Allow to independently customise go OS and ARCH flags independently and following the standard practices.
# Allow to independently customise go OS and ARCH flags.
# Defaulting to linux/amd64 as per CONTAINER_OS_ARCH.
GOOS=linux
GOARCH=amd64
Expand Down
4 changes: 3 additions & 1 deletion components/consumers/jira/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ CONTAINER_REPO=
DRACON_VERSION=
SOURCE_CODE_REPO=
PRODUCER_AGGREGATOR_BASE_IMAGE=$(shell test -e .custom_image && cat .custom_image || echo "scratch")
# https://docs.docker.com/build/building/multi-platform/
# Make sure to always build containers using AMD64 but allow to be overridden by users if need for cross-os compatibility.
CONTAINER_OS_ARCH=linux/amd64
# Allow to independently customise go OS and ARCH flags independently and following the standard practices.
# Allow to independently customise go OS and ARCH flags.
# Defaulting to linux/amd64 as per CONTAINER_OS_ARCH.
GOOS=linux
GOARCH=amd64
Expand Down
4 changes: 3 additions & 1 deletion components/consumers/slack/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ CONTAINER_REPO=
DRACON_VERSION=
SOURCE_CODE_REPO=
PRODUCER_AGGREGATOR_BASE_IMAGE=$(shell test -e .custom_image && cat .custom_image || echo "scratch")
# https://docs.docker.com/build/building/multi-platform/
# Make sure to always build containers using AMD64 but allow to be overridden by users if need for cross-os compatibility.
CONTAINER_OS_ARCH=linux/amd64
# Allow to independently customise go OS and ARCH flags independently and following the standard practices.
# Allow to independently customise go OS and ARCH flags.
# Defaulting to linux/amd64 as per CONTAINER_OS_ARCH.
GOOS=linux
GOARCH=amd64
Expand Down
4 changes: 3 additions & 1 deletion components/producers/aggregator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ CONTAINER_REPO=
DRACON_VERSION=
SOURCE_CODE_REPO=
PRODUCER_AGGREGATOR_BASE_IMAGE=$(shell test -e .custom_image && cat .custom_image || echo "scratch")
# https://docs.docker.com/build/building/multi-platform/
# Make sure to always build containers using AMD64 but allow to be overridden by users if need for cross-os compatibility.
CONTAINER_OS_ARCH=linux/amd64
# Allow to independently customise go OS and ARCH flags independently and following the standard practices.
# Allow to independently customise go OS and ARCH flags.
# Defaulting to linux/amd64 as per CONTAINER_OS_ARCH.
GOOS=linux
GOARCH=amd64
Expand Down
4 changes: 3 additions & 1 deletion components/producers/github-code-scanning/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ CONTAINER_REPO=
DRACON_VERSION=
SOURCE_CODE_REPO=
PRODUCER_AGGREGATOR_BASE_IMAGE=$(shell test -e .custom_image && cat .custom_image || echo "scratch")
# https://docs.docker.com/build/building/multi-platform/
# Make sure to always build containers using AMD64 but allow to be overridden by users if need for cross-os compatibility.
CONTAINER_OS_ARCH=linux/amd64
# Allow to independently customise go OS and ARCH flags independently and following the standard practices.
# Allow to independently customise go OS and ARCH flags.
# Defaulting to linux/amd64 as per CONTAINER_OS_ARCH.
GOOS=linux
GOARCH=amd64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ESLINT_WRAPPER_BASE_IMAGE=$(shell test -e .custom_image && cat .custom_image ||
# https://docs.docker.com/build/building/multi-platform/
# Make sure to always build containers using AMD64 but allow to be overridden by users if need for cross-os compatibility.
CONTAINER_OS_ARCH=linux/amd64
# Allow to independently customise go OS and ARCH flags independently and following the standard practices.
# Allow to independently customise go OS and ARCH flags.
# Defaulting to linux/amd64 as per CONTAINER_OS_ARCH.
GOOS=linux
GOARCH=amd64
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ These can be passed to the make commands used to build binaries, for example:
make GOOS=linux GOARCH=arm64 component-binaries
```

By default, when no supplied, `linux` and `amd64` are the default.
By default `linux` and `amd64` are used.

\**For Apple Silicon chips, you might want to use
`GOOS=darwin` and `GOARCH=arm64` when building binaries
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_component_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ executable_src_path=$(dirname "${1}")
executable_path=$(dirname $(dirname "${1}"))/"${executable}"

# Customised bin per OS/ARCH.
out_bin_path="bin/${executable_src_path}/$GOOS/$GOARCH/${executable}"
out_bin_path="bin/${executable_src_path}/${GOOS}/${GOARCH}/${executable}"

echo "building $out_bin_path" > /dev/stderr

Expand Down
12 changes: 6 additions & 6 deletions scripts/build_component_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ fi
dir_name="$1"
build_architecture="$2"

executable=$(basename $(dirname $dir_name))
executable=$(basename $(dirname ${dir_name}))

echo $dir_name | grep -Eq ^components/producers/.*$ && executable="${executable}-parser" || true
echo $dir_name | grep -Eq ^components/enrichers/.*$ && executable="${executable}" || true
echo $dir_name | grep -Eq ^components/consumers/.*$ && executable="${executable}" || true
echo ${dir_name} | grep -Eq ^components/producers/.*$ && executable="${executable}-parser" || true
echo ${dir_name} | grep -Eq ^components/enrichers/.*$ && executable="${executable}" || true
echo ${dir_name} | grep -Eq ^components/consumers/.*$ && executable="${executable}" || true

executable_src_path=$(dirname $dir_name)
executable_path=$(dirname $dir_name)/$build_architecture/"${executable}"
executable_path=$(dirname $dir_name)/${build_architecture}/"${executable}"

if make -C "${executable_src_path}" --no-print-directory --dry-run container >/dev/null 2>&1
then
Expand All @@ -49,7 +49,7 @@ else
docker build -t "${CONTAINER_REPO}/${executable_src_path}:${DRACON_VERSION}" \
$([ "${SOURCE_CODE_REPO}" != "" ] && echo "--label=org.opencontainers.image.source=${SOURCE_CODE_REPO}" ) \
-f "${dockerfile_path}" ./bin \
--platform=$build_architecture
--platform=${build_architecture}
fi

if make -C "${executable_src_path}" --no-print-directory --dry-run extras >/dev/null 2>&1
Expand Down

0 comments on commit c9b077f

Please sign in to comment.