-
Notifications
You must be signed in to change notification settings - Fork 7
/
docker-build.sh
executable file
·50 lines (44 loc) · 1.35 KB
/
docker-build.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
#!/bin/bash
# Copyright 2024 OpenVPN Inc <[email protected]>
# SPDX-License-Identifier: Apache-2.0
set -eu
as_version=""
registry_image_name="openvpn/openvpn-as"
usage() {
echo
echo "Usage: $0 -v <as_version> [-r <registry_image_name>]"
echo
echo "as_version - version of 'openvpn-as' DEB package"
echo "example: '$0 2.12.1-bc070def-Ubuntu22'"
echo "it is used as a docker image tag too"
echo
echo "registry_image_name - custom image registry to tag and push"
echo "by default it pushes into Docker Hub: 'openvpn/openvpn-as'"
echo
echo "Please note: the multi-platform image build is used"
echo "https://docs.docker.com/build/building/multi-platform/"
}
while getopts ":v:r:" opt; do
case $opt in
v)
as_version="$OPTARG"
;;
r)
registry_image_name="$OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage
;;
:)
echo "Option -$OPTARG requires an argument." >&2
usage
;;
esac
done
if [ -z "$as_version" ]; then
echo "Error: AS version is required." >&2
usage
exit 1
fi
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -f Dockerfile --build-arg="VERSION=$as_version" -t $registry_image_name:$as_version -t $registry_image_name:latest --push .