forked from liferay/liferay-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_caddy_image.sh
executable file
·51 lines (40 loc) · 1.43 KB
/
build_caddy_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
#!/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}/caddy:${image_version}-${TIMESTAMP}")
DOCKER_IMAGE_TAGS+=("${LIFERAY_DOCKER_REPOSITORY}/caddy")
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 Caddy" \
--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 Caddy" \
--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 {
make_temp_directory templates/caddy
log_in_to_docker_hub
build_docker_image "${1}"
clean_up_temp_directory
}
main "${@}"