forked from Flaconi/docker-atlantis-terragrunt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (42 loc) · 1.49 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
ifneq (,)
.error This Makefile requires GNU Make.
endif
.PHONY: build test pull tag login push enter
DIR = .
FILE = Dockerfile
IMAGE = "flaconi/atlantis-terragrunt"
TAG = latest
# Versions
ATLANTIS = '0.23.5'
TERRAFORM = '1.4.5'
TERRAGRUNT = '0.45.4'
TERRAGRUNT_ATLANTIS_CONFIG = '1.16.0'
pull:
docker pull $(shell grep FROM Dockerfile | sed 's/^FROM//g' | sed "s/\$${ATLANTIS}/$(ATLANTIS)/g";)
build:
docker build \
--network=host \
--build-arg ATLANTIS=$(ATLANTIS) \
--build-arg TERRAFORM=$(TERRAFORM) \
--build-arg TERRAGRUNT=$(TERRAGRUNT) \
--build-arg TERRAGRUNT_ATLANTIS_CONFIG=$(TERRAGRUNT_ATLANTIS_CONFIG) \
-t $(IMAGE) -f $(DIR)/$(FILE) $(DIR)
test:
docker run --rm --entrypoint atlantis ${IMAGE} version | grep -E '^atlantis v$(ATLANTIS) '
docker run --rm --entrypoint terraform ${IMAGE} --version | grep -E 'v$(TERRAFORM)$$'
docker run --rm --entrypoint terragrunt ${IMAGE} --version | grep -E 'v$(TERRAGRUNT)$$'
docker run --rm --entrypoint terragrunt-atlantis-config ${IMAGE} version | grep -E "$(TERRAGRUNT_ATLANTIS_CONFIG)$$"
tag:
docker tag $(IMAGE) $(IMAGE):$(TAG)
login:
ifndef DOCKER_USER
$(error DOCKER_USER must either be set via environment or parsed as argument)
endif
ifndef DOCKER_PASS
$(error DOCKER_PASS must either be set via environment or parsed as argument)
endif
@yes | docker login --username $(DOCKER_USER) --password $(DOCKER_PASS)
push:
docker push $(IMAGE):$(TAG)
enter:
docker run --rm --name $(subst /,-,$(IMAGE)) -it --entrypoint=/bin/sh $(ARG) $(IMAGE)