-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (32 loc) · 905 Bytes
/
Makefile
File metadata and controls
39 lines (32 loc) · 905 Bytes
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
IMAGE := pyramation/node-sqitch
TAG := 20.12.0
PLATFORMS := linux/amd64,linux/arm64
CONTAINER_NAME := node-sqitch
.PHONY: build push tag-latest ssh cleanup clean-images
build:
docker buildx build \
--platform $(PLATFORMS) \
-t $(IMAGE):$(TAG) \
--output=type=docker \
.
push: tag-latest
docker buildx build \
--platform $(PLATFORMS) \
-t $(IMAGE):$(TAG) \
-t $(IMAGE):latest \
--push \
.
tag-latest:
docker tag $(IMAGE):$(TAG) $(IMAGE):latest
ssh:
docker run --platform=linux/arm64 -it $(IMAGE):$(TAG) sh
cleanup:
@if [ ! -z "$$(docker ps -aq -f name=$(CONTAINER_NAME))" ]; then \
echo "Stopping and removing existing container..."; \
docker stop $(CONTAINER_NAME) && docker rm $(CONTAINER_NAME); \
fi
clean-images:
@if docker images | grep $(IMAGE); then \
echo "Removing Docker images for $(IMAGE)..."; \
docker rmi $(IMAGE):$(TAG) $(IMAGE):latest || true; \
fi