-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
82 lines (49 loc) · 2.42 KB
/
Makefile
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
REGISTRY_HOST=docker.io
USERNAME=ripl
#NAME=$(shell basename $(CURDIR))
NAME=libbot2-ros
IMAGE=$(USERNAME)/$(NAME)
# Ubuntu versions are stored in the .env file
include .env
# Base environments
#BASE_IMAGE_ENVIRONMENT_LATEST = ubuntu:${ROS_VERSION_LATEST}
#BASE_IMAGE_ENVIRONMENT_PREVIOUS = ubuntu:${ROS_VERSION_PREVIOUS}
# Tag: latest
BUILD_IMAGE_LATEST = $(IMAGE):${ROS_VERSION_LATEST}
BUILD_IMAGE_PREVIOUS = $(IMAGE):${ROS_VERSION_PREVIOUS}
.PHONY: pre-build docker-build build release showver \
push cleanup
build: pre-build docker-build ## builds a new version of the container image(s)
pre-build: ## Update the base environment images
#docker pull $(BASE_IMAGE_ENVIRONMENT_LATEST)
#docker pull $(BASE_IMAGE_ENVIRONMENT_PREVIOUS)
post-build:
pre-push:
post-push:
docker-build:
# Build latest with multiple tags
docker buildx build --platform linux/arm64/v8,linux/amd64 --tag $(BUILD_IMAGE_LATEST) --tag $(IMAGE):latest -f Dockerfile.${ROS_VERSION_LATEST} .
# Build previous
docker buildx build --platform linux/arm64/v8,linux/amd64 --tag $(BUILD_IMAGE_PREVIOUS) -f Dockerfile.${ROS_VERSION_PREVIOUS} .
# Build kinetic
docker buildx build --platform linux/arm64/v8,linux/amd64 --tag $(IMAGE):kinetic -f Dockerfile.kinetic .
release: build push ## builds a new version of your container image(s), and pushes it/them to the registry
push: pre-push do-push post-push ## pushes the images to dockerhub
do-push:
# Push lateset
docker buildx build --platform linux/arm64/v8,linux/amd64 --push --tag $(BUILD_IMAGE_LATEST) --tag $(IMAGE):latest -f Dockerfile.${ROS_VERSION_LATEST} .
# Push previous
docker buildx build --platform linux/arm64/v8,linux/amd64 --push --tag $(BUILD_IMAGE_PREVIOUS) -f Dockerfile.${ROS_VERSION_PREVIOUS} .
# Push kinetic
docker buildx build --platform linux/arm64/v8,linux/amd64 --push --tag $(IMAGE):kinetic -f Dockerfile.kinetic .
cleanup: ## Remove images pulled/generated as part of the build process
docker rmi $(BUILD_IMAGE_LATEST)
docker rmi $(IMAGE):latest
docker rmi $(BUILD_IMAGE_PREVIOUS)
docker rmi $(IMAGE):kinetic
#docker rmi $(BASE_IMAGE_ENVIRONMENT_LATEST)
#docker rmi $(BASE_IMAGE_ENVIRONMENT_PREVIOUS)
showver: ## shows the current release tag based on the workspace
echo "RELEASE_VERSION: $(RELEASE_VERSION)"
help: ## show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | grep -v fgrep | sed -e 's/\([^:]*\):[^#]*##\(.*\)/printf '"'%-20s - %s\\\\n' '\1' '\2'"'/' |bash