File: build_docker_image.sh

package info (click to toggle)
cyclonedds 0.10.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,420 kB
  • sloc: ansic: 223,506; perl: 1,904; xml: 1,895; yacc: 1,018; sh: 882; python: 106; makefile: 94
file content (82 lines) | stat: -rwxr-xr-x 1,756 bytes parent folder | download | duplicates (3)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash

# Copyright(c) 2020 Prasanna Bhat

# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.

# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause

set -e 

BUILD_UBUNTU=false
BUILD_CYCLONEDDS=false

usage() {
	echo ""
	echo "Helper script to build docker images for cyclonedds"
	echo "Usage : "
	echo "<workspace>/scripts/docker/build_docker_image.sh [images]"
	echo "Supported images are "
	echo "ubuntu 		: ubuntu based image to build cyclone dds. Contains dependencies to build cyclonedds."
	echo "cyclonedds	: pre-built cyclonedds core libs & example applications. Can be quickly used to test cyclonedds apps."
	echo ""
}

parse_args() {
	for arg in "$@"
	do
		case $arg in
		    -h | --help)
			usage
			exit 0
			;;
			ubuntu)
			BUILD_UBUNTU=true
			;;
			cyclonedds)
			BUILD_CYCLONEDDS=true
			;;
			*)
			echo "ERROR : unknown parameter $arg"
			usage
			exit 1
			;;
		esac
	done
}



if [ "$#" -eq 0 ] 
then
	echo "Supply at least one argument"
	echo "Run with -h/--help for usage"
	exit 1
fi
parse_args $@


DOCKERFILE_DIR="$(dirname "$(readlink -fm "$0")")"
WORKSPACE="$(dirname "$(dirname "${DOCKERFILE_DIR}")")"
echo "WORKSPACE is $WORKSPACE"
cd "$WORKSPACE"

if [ $BUILD_UBUNTU == true ]
then
	UBUNTU_IMAGE="ubuntu:cyclonedds"
	docker build --file "${DOCKERFILE_DIR}/Dockerfile" . --tag "${UBUNTU_IMAGE}"
fi

if [ $BUILD_CYCLONEDDS == true ]
then
	CYCLONEDDS_IMAGE="cyclonedds:latest"
	docker build --file "${DOCKERFILE_DIR}/DockerfileCycloneDds" . --tag "${CYCLONEDDS_IMAGE}"
fi