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
37 changes: 10 additions & 27 deletions buildkite/src/Command/DockerImage.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ let generateStep =
}
spec.size

let loadOnlyArg =
if DockerPublish.shouldPublish
spec.docker_publish
spec.service

then ""

else " --load-only "

let buildDockerCmd =
"./scripts/docker/build.sh"
++ " --service ${Artifacts.dockerName spec.service}"
Expand All @@ -184,38 +193,14 @@ let generateStep =
++ " --repo ${spec.repo}"
++ " --platform ${Arch.platform spec.arch}"
++ " --docker-registry ${DockerRepo.show spec.docker_repo}"

let releaseDockerCmd =
if DockerPublish.shouldPublish
spec.docker_publish
spec.service

then "./scripts/docker/release.sh"
++ " --service ${Artifacts.dockerName spec.service}"
++ " --version ${spec.version}"
++ " --network ${Network.lowerName spec.network}"
++ " --deb-codename ${DebianVersions.lowerName
spec.deb_codename}"
++ " --deb-version ${spec.deb_version}"
++ " --deb-profile ${Profiles.lowerName
spec.deb_profile}"
++ " --deb-build-flags ${BuildFlags.lowerName
spec.build_flags}"
++ " --platform ${Arch.platform spec.arch}"
++ " --docker-registry ${DockerRepo.show
spec.docker_repo}"

else " echo In order to ensure storage optimization, skipping publishing docker as this is not essential one or publishing is disabled . Docker publish setting is set to ${DockerPublish.show
spec.docker_publish}."
++ loadOnlyArg

let remoteRepoCmds =
[ Cmd.run
( exportMinaDebCmd
++ " && source ./buildkite/scripts/export-git-env-vars.sh "
++ " && "
++ buildDockerCmd
++ " && "
++ releaseDockerCmd
++ maybeVerify
)
]
Expand All @@ -236,8 +221,6 @@ let generateStep =
++ " && source ./buildkite/scripts/export-git-env-vars.sh "
++ " && "
++ buildDockerCmd
++ " && "
++ releaseDockerCmd
++ maybeStopDebianRepo
++ maybeVerify
)
Expand Down
10 changes: 8 additions & 2 deletions scripts/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,17 @@ function usage() {
echo " --deb-build-flags The build-flags string for the debian package to install"
echo " --deb-suffix The debian suffix to use for the docker image"
echo " -p, --platform The target platform for the docker build (e.g. linux/amd64). Default=linux/amd64"
echo " -l, --load-only Load the built image into local docker daemon only, do not push to remote registry"
echo ""
echo "Example: $0 --service faucet --version v0.1.0"
echo "Valid Services: ${VALID_SERVICES[*]}"
exit 1
}

# Defines if build is for pushing to remote registry or loading locally only.
# Can be overridden with --load-only flag.
DOCKER_ACTION="push"

while [[ "$#" -gt 0 ]]; do case $1 in
-s|--service) SERVICE="$2"; shift;;
-v|--version) VERSION="$2"; shift;;
Expand All @@ -47,6 +52,7 @@ while [[ "$#" -gt 0 ]]; do case $1 in
-c|--cache-from) INPUT_CACHE="$2"; shift;;
-r|--repo) MINA_REPO="$2"; shift;;
-p|--platform) INPUT_PLATFORM="$2"; shift;;
-l|--load-only) DOCKER_ACTION="load" ;;
--docker-registry) export DOCKER_REGISTRY="$2"; shift;;
--no-cache) NO_CACHE="--no-cache"; ;;
--deb-codename) INPUT_CODENAME="$2"; shift;;
Expand Down Expand Up @@ -254,9 +260,9 @@ BUILD_NETWORK="--allow=network.host"
# If DOCKER_CONTEXT is not specified, assume none and just pipe the dockerfile into docker build
if [[ -z "${DOCKER_CONTEXT}" ]]; then
cat $DOCKERFILE_PATH | docker buildx build --network=host \
--load --progress=plain $PLATFORM $DEBIAN_ARCH_ARG $CANONICAL_ARCH_ARG $DOCKER_REPO_ARG $NO_CACHE $BUILD_NETWORK $CACHE $NETWORK $IMAGE $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $DOCKER_DEB_SUFFIX $DEB_REPO $BRANCH $REPO $LEGACY_VERSION -t "$TAG" -
--"$DOCKER_ACTION" --progress=plain $PLATFORM $DEBIAN_ARCH_ARG $CANONICAL_ARCH_ARG $DOCKER_REPO_ARG $NO_CACHE $BUILD_NETWORK $CACHE $NETWORK $IMAGE $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $DOCKER_DEB_SUFFIX $DEB_REPO $BRANCH $REPO $LEGACY_VERSION -t "$TAG" -t "$HASHTAG" -
else
docker buildx build --load --network=host --progress=plain $PLATFORM $DEBIAN_ARCH_ARG $CANONICAL_ARCH_ARG $DOCKER_REPO_ARG $NO_CACHE $BUILD_NETWORK $CACHE $NETWORK $IMAGE $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $DOCKER_DEB_SUFFIX $DEB_REPO $BRANCH $REPO $LEGACY_VERSION "$DOCKER_CONTEXT" -t "$TAG" -f $DOCKERFILE_PATH
docker buildx build --"$DOCKER_ACTION" --network=host --progress=plain $PLATFORM $DEBIAN_ARCH_ARG $CANONICAL_ARCH_ARG $DOCKER_REPO_ARG $NO_CACHE $BUILD_NETWORK $CACHE $NETWORK $IMAGE $DEB_CODENAME $DEB_RELEASE $DEB_VERSION $DOCKER_DEB_SUFFIX $DEB_REPO $BRANCH $REPO $LEGACY_VERSION "$DOCKER_CONTEXT" -t "$TAG" -t "$HASHTAG" -f $DOCKERFILE_PATH
fi

echo "✅ Docker image for service ${SERVICE} built successfully."
Expand Down
60 changes: 0 additions & 60 deletions scripts/docker/release.sh

This file was deleted.