-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (35 loc) · 1.02 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
# Define variables for build args
ALPINE_VERSION := 3.20.2
CONTAINERFILE=Containerfile
# User may specify the architecture to build else build for the host
ARCH ?= $(shell uname -m)
ifeq ($(filter $(ARCH), x86_64 arm64),)
$(error Unsupported architecture: $(ARCH))
endif
ARCH := $(if $(filter $(ARCH), x86_64),amd64,arm64v8)
# Define the docker image name
IMAGE_NAME := $(ARCH)/krakatoa
.PHONY: build
build:
docker build \
--build-arg ARCH=$(ARCH) \
--build-arg ALPINE_VERSION=$(ALPINE_VERSION) \
-t $(IMAGE_NAME) \
-f $(CONTAINERFILE) \
.
.PHONY: start
start:
docker run --rm -v$(PWD)/mount:/volumes -td $(IMAGE_NAME)
.PHONY: stop
stop:
docker stop $(shell docker ps --filter "ancestor=$(IMAGE_NAME)" --format "{{.ID}}")
.PHONY: attach
attach:
docker exec -ti $(shell docker ps --filter "ancestor=$(IMAGE_NAME)" --format "{{.ID}}" | head -n1) sh
.PHONY: run
run:
docker run -v$(PWD)/volumes:/volumes --rm -ti $(IMAGE_NAME) sh
.PHONY: clean
clean:
docker rmi $(IMAGE_NAME)
docker rmi $(ARCH)/alpine:$(ALPINE_VERSION)