-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (39 loc) · 1.11 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
.PHONY: test build clean
name = fhir-server
build_dir = bin
os = $(shell go env GOOS)
arch = $(shell go env GOARCH)
port = 9090
image_version = v1.0.0
image_tag = $(name)-image:$(image_version)
container = $(name)-container
air_hot_reload = bin/air
export DOCKER_BUILDKIT=1
test:
go test -v ./...
test-db:
go test -timeout 30s -run ^TestNewDbHandler -v ./...
clean:
rm -rf $(build_dir)/*
go clean
run-server:
$(build_dir)/$(name) --verbose
dev-server:
if [ ! -f $(air_hot_reload) ]; then \
curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s; \
fi
$(air_hot_reload) -c .air.toml
build-server:
GOOS=$(os) GOARCH=$(arch) CGO_ENABLED=0 go build -o $(build_dir)/$(name) .
build-image:
docker build -t $(image_tag) -f Dockerfile.multistage .
start-container:
docker run -p $(port):$(port) --name $(container) --rm $(image_tag)
stop-container:
docker stop $(container)
start: build-image start-container
stop: stop-container
fhir-examples:
wget https://www.hl7.org/fhir/R4/examples-json.zip -O examples-json.zip
unzip examples-json.zip -d examples-json
rm -rf examples-json.zip