-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (31 loc) · 1.19 KB
/
Makefile
File metadata and controls
54 lines (31 loc) · 1.19 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
42
43
44
45
46
47
48
49
50
51
52
53
54
AWS_ACCOUNT_ID := 742460038063
AWS_DEFAULT_REGION := eu-west-3
AWS_ECR_DOMAIN := $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_DEFAULT_REGION).amazonaws.com
GIT_SHA := $(shell git rev-parse HEAD)
BUILD_IMAGE := $(AWS_ECR_DOMAIN)/staging
BUILD_TAG := $(if $(BUILD_TAG),$(BUILD_TAG),latest)
.DEFAULT_GOAL := build
test:
mvn test
build:
mvn clean package -DskipTests
build-image:
docker buildx build --platform "linux/amd64" --tag "$(BUILD_IMAGE):$(GIT_SHA)-build" --target "build" .
docker buildx build --cache-from "$(BUILD_IMAGE):$(GIT_SHA)-build" --platform "linux/amd64" --tag "$(BUILD_IMAGE):$(GIT_SHA)" .
build-image-login:
aws ecr get-login-password --region $(AWS_DEFAULT_REGION) | docker login --username AWS --password-stdin $(AWS_ECR_DOMAIN)
build-image-push: build-image-login
docker image push $(BUILD_IMAGE):$(GIT_SHA)
build-image-pull: build-image-login
docker image pull $(BUILD_IMAGE):$(GIT_SHA)
output-image:
@echo "$(BUILD_IMAGE):$(GIT_SHA)"
deploy:
$env:AWS_ACCOUNT_ID=$(AWS_ACCOUNT_ID); \
$env:AWS_DEFAULT_REGION=$(AWS_DEFAULT_REGION); \
$env:AWS_ECR_DOMAIN=$(AWS_ECR_DOMAIN); \
.\deploy.ps1
down:
docker compose down --remove-orphans --volumes
up: down
docker compose up --detach