-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile
58 lines (48 loc) · 1.8 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
54
55
56
57
58
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.33.0'
TERRAFORM = '1.10.5'
TERRAGRUNT = '0.72.6'
TERRAGRUNT_ATLANTIS_CONFIG = '1.19.0'
SOPS = '3.9.4'
ONE_PASSWORD_CLI = '2.30.3'
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) \
--build-arg SOPS=$(SOPS) \
--build-arg ONE_PASSWORD_CLI=$(ONE_PASSWORD_CLI) \
-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)$$'
docker run --rm --entrypoint sops ${IMAGE} --version --disable-version-check | grep -E '^sops $(SOPS)$$'
docker run --rm --entrypoint op ${IMAGE} --version | grep -E '$(ONE_PASSWORD_CLI)$$'
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)