-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
53 lines (43 loc) · 1.57 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
## ----------------------------------------------------------------------
## Builder for creating Docker images on multiple platform architectures.
## This takes advantage if the buildx builder in docker which can
## cross-compile images for other targets.
## ----------------------------------------------------------------------
# These can be overidden with env vars.
REGISTRY ?= rofrano
IMAGE_NAME ?= pipeline-selenium
IMAGE_TAG ?= latest
IMAGE ?= $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)
PLATFORM ?= "linux/amd64,linux/arm64"
# Set up the Docker build environment
.EXPORT_ALL_VARIABLES:
DOCKER_BUILDKIT = 1
all: help
## help: Lists help on the commands
.PHONY: help
help: Makefile
@sed -ne '/@sed/!s/## //p' $(MAKEFILE_LIST)
.PHONY: clean
clean: ## Removes all dangling build cache
$(info Removing all dangling build cache)
docker buildx prune -f
.PHONY: init
init: export DOCKER_BUILDKIT=1
init: ## Creates the buildx instance
$(info Initializing Builder...)
-docker buildx create --name qemu --driver=docker-container
docker buildx use qemu
docker buildx inspect --bootstrap
.PHONY: build
build: ## Build all of the project Docker images
$(info Building $(IMAGE) for $(PLATFORM)...)
docker buildx build --pull --platform=$(PLATFORM) --tag $(IMAGE) --push .
.PHONY: run
run: ## Run a container using this image
$(info Bringing up container with Docker...)
docker run --rm -it -h nyu --user vscode -v $(PWD):/app -w /app $(IMAGE) bash
.PHONY: remove
remove: ## Stop and remove the buildx builder
$(info Stopping and removing the builder image...)
docker buildx stop
docker buildx rm