-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpush-image.sh
executable file
·38 lines (34 loc) · 1.18 KB
/
push-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
#!/bin/bash
# push-image.sh
# push-image.sh builds and pushes the multi-platform linuxforhealth/x12 image to an image repository.
#
# Pre-Requisites:
# - The script environment is authenticated to the target image repository.
# - The project has been built and a wheel exists in <project root>/dist.
#
# Usage:
# ./push-image [image_tag] [image_url] [platforms]
#
# Positional Script arguments:
# IMAGE_TAG - Aligns with the project's semantic version. Required.
# IMAGE_URL - The image's URL. Defaults to ghcr.io/linuxforhealth/x12.
# PLATFORMS - String containing the list of platforms. Defaults to linux/amd64,linux/arm64,linux/s390x.
set -o errexit
set -o nounset
set -o pipefail
if [[ $# == 0 ]]
then
echo "Missing required argument IMAGE_TAG"
echo "Usage: ./push-image.sh [image tag] [image url] [platforms]"
exit 1;
fi
IMAGE_TAG=$1
IMAGE_URL="${2:-ghcr.io/linuxforhealth/x12}"
PLATFORMS="${3:-linux/amd64,linux/arm64,linux/s390x}"
docker buildx build \
--pull \
--push \
--platform "$PLATFORMS" \
--build-arg X12_SEM_VER="$IMAGE_TAG" \
--tag "$IMAGE_URL":"$IMAGE_TAG" \
--tag "$IMAGE_URL":latest .