-
Notifications
You must be signed in to change notification settings - Fork 147
/
build_job_runner_image.sh
executable file
·53 lines (41 loc) · 1.52 KB
/
build_job_runner_image.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
source ./_common.sh
function build_docker_image {
local image_version=$(./release_notes.sh get-version)
DOCKER_IMAGE_TAGS=()
DOCKER_IMAGE_TAGS+=("${LIFERAY_DOCKER_REPOSITORY}/job-runner:${image_version}-${TIMESTAMP}")
DOCKER_IMAGE_TAGS+=("${LIFERAY_DOCKER_REPOSITORY}/job-runner")
if [ "${1}" == "push" ]
then
check_docker_buildx
docker buildx build \
--build-arg LABEL_BUILD_DATE=$(date "${CURRENT_DATE}" "+%Y-%m-%dT%H:%M:%SZ") \
--build-arg LABEL_NAME="Liferay Job Runner" \
--build-arg LABEL_VCS_REF=$(git rev-parse HEAD) \
--build-arg LABEL_VCS_URL="https://github.com/liferay/liferay-docker" \
--build-arg LABEL_VERSION="${image_version}" \
--builder "liferay-buildkit" \
--platform "${LIFERAY_DOCKER_IMAGE_PLATFORMS}" \
--push \
$(get_docker_image_tags_args "${DOCKER_IMAGE_TAGS[@]}") \
"${TEMP_DIR}" || exit 1
else
remove_temp_dockerfile_target_platform
docker build \
--build-arg LABEL_BUILD_DATE=$(date "${CURRENT_DATE}" "+%Y-%m-%dT%H:%M:%SZ") \
--build-arg LABEL_NAME="Liferay Job Runner" \
--build-arg LABEL_VCS_REF=$(git rev-parse HEAD) \
--build-arg LABEL_VCS_URL="https://github.com/liferay/liferay-docker" \
--build-arg LABEL_VERSION="${image_version}" \
$(get_docker_image_tags_args "${DOCKER_IMAGE_TAGS[@]}") \
"${TEMP_DIR}" || exit 1
fi
}
function main {
delete_local_images "${LIFERAY_DOCKER_REPOSITORY}/job-runner"
make_temp_directory templates/job-runner
log_in_to_docker_hub
build_docker_image "${1}"
clean_up_temp_directory
}
main "${@}"