-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
110 lines (87 loc) · 2.22 KB
/
Makefile
File metadata and controls
110 lines (87 loc) · 2.22 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#
# Solution Makefile
#
#
# Constants
#
UNIQUEIFIER_PATH = artefacts/uniqueifier#
LOCAL_API_DOCKER_PORT = 5002#
include sharedScripts/make/dockerImages.mk
clean:
rm -r */*/out || true
rm -r */*/bin || true
rm -r */*/obj || true
rm -r artefacts || true
mkdir -p \
artefacts/testResults \
artefacts/local
cp -r deploy artefacts/
#
# Build
#
build: clean
dotnet build -c Release
unit-tests: publish-unit-tests
cd test/UnitTests; \
make run
ci: build unit-tests
publish-api: build
cd src/StringSearch.Api.Host && \
dotnet publish -c Release --no-build -o out
publish-unit-tests: build
cd test/UnitTests && \
dotnet publish -c Release --no-build -o out
publish-all: publish-api publish-unit-tests
#
# Uniqueifier
#
# Args:
# - buildId (remote only)
# - commitHash (remote only - optional)
generate-uniqueifier:
# If running locally
ifeq ($(buildId),)
date +%Y-%m-%d-%H-%M-%S > $(UNIQUEIFIER_PATH)
else
# If we haven't been supplied with a commit hash, get it from git
ifeq ($(commitHash),)
$(eval commitHash = $(shell git rev-parse --short HEAD))
endif
echo -n $(buildId)-$(commitHash) > $(UNIQUEIFIER_PATH)
endif
#
# Docker Images
#
# Args:
# - buildId (remote only)
# - commitHash (remote only - optional)
build-api-image: generate-uniqueifier
docker build --pull -t $(IMAGE_API):$(shell cat $(UNIQUEIFIER_PATH)) src/StringSearch.Api.Host
publish-api-image:
docker push $(IMAGE_API):$(shell cat $(UNIQUEIFIER_PATH))
# Args:
# - crUsername
# - crPassword
docker-login:
@docker login $(CONTAINER_REGISTRY_HOSTNAME) -u $(crUsername) -p $(crPassword)
#
# Run locally
#
# Args
# - rootPath
run-local-api-docker: publish-api build-api-image
ifeq ($(rootPath),)
$(error rootPath must be specified)
endif
cd build; \
/bin/bash generateDockerLocalAppSettings.sh
export MSYS_NO_PATHCONV=1; \
docker run \
--rm \
-v "$(rootPath)":/var/www/pi_digits:ro \
-e ASPNETCORE_ENVIRONMENT="DockerLocal" \
-e ASPNETCORE_URLS="http://*:$(LOCAL_API_DOCKER_PORT)" \
-e UNIQUEIFIER="$(shell cat $(UNIQUEIFIER_PATH))" \
-p $(LOCAL_API_DOCKER_PORT):$(LOCAL_API_DOCKER_PORT) \
-v "${PWD}/artefacts/local/appsettings.DockerLocal.json":/app/appsettings.DockerLocal.json:ro \
$(IMAGE_API):$(shell cat $(UNIQUEIFIER_PATH))