-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (32 loc) · 1.61 KB
/
Makefile
File metadata and controls
41 lines (32 loc) · 1.61 KB
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
MAKEFILE_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
BAKE_SCRIPT:=$(MAKEFILE_DIR)/buildtools/docker-bake.hcl
BUILDX_HOST_PLATFORM:=$(shell docker buildx inspect default | sed -nE 's/^Platforms: ([^,]*),.*$$/\1/p')
BAKE:=docker buildx bake --builder default --load --set *.platform=$(strip $(BUILDX_HOST_PLATFORM)) -f $(BAKE_SCRIPT)
IMAGE_NAME?=duynd2357/starling-controller
NETWORK?=bridge
ENV?=
RUN_ARGS?=
all: build
help:
@echo "all - run build"
@echo "build - build the dockerfile for this project"
@echo "run - builds and runs the dockerfile for this project"
@echo "run_bash - builds and runs the dockerfile putting you into a bash shell"
@echo "local-build-push - locally builds and pushes amd64 and arm64 variants of your container"
@echo "help - show this help screen"
build:
@git clone --recurse-submodules https://github.com/CD3/libInterpolate.git starling_controller/onboard_controller/external/libInterpolate
$(BAKE) starling_controller
@rm -rf starling_controller/onboard_controller/external/libInterpolate
local-build-setup:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
local-build-push:
docker buildx bake --builder mybuilder -f $(BAKE_SCRIPT) --push starling-controller
run: build
docker run -it --rm --net=$(NETWORK) $(ENV) -e USE_SIMULATED_TIME=true $(RUN_ARGS) $(IMAGE_NAME)
run_bash: build
docker run -it --rm --net=$(NETWORK) $(ENV) -e USE_SIMULATED_TIME=true $(RUN_ARGS) $(IMAGE_NAME) bash
.PHONY: all build local-build-setup local-build-push run run_bash