-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
84 lines (62 loc) · 2.5 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
ocean-prefilter: main.go
go build -o ocean-prefilter main.go
TAG_VERSION?=latest
ifeq (${ARCH_TAG},arm64)
ARCH_NAME = aarch64
else ifeq (${ARCH_TAG},amd64)
ARCH_NAME = x86_64
else
ARCH_NAME = none
endif
ocean-prefilter-appimage: export TAG_NAME = ${TAG_VERSION}
ocean-prefilter-appimage: ocean-prefilter
cd packaging/appimages && \
mkdir -p deploy && \
rm -f deploy/ocean-prefilter* && \
appimage-builder --recipe ocean-prefilter-${ARCH_NAME}.yml
cp ./packaging/appimages/ocean-prefilter-*-${ARCH_NAME}.AppImage ./packaging/appimages/deploy/
cp ./packaging/appimages/deploy/ocean-prefilter-${TAG_VERSION}-${ARCH_NAME}.AppImage ocean-prefilter-appimage
chmod a+x ocean-prefilter-appimage
module.tar.gz: ocean-prefilter-appimage
tar czf module.tar.gz ocean-prefilter-appimage
clean:
rm -rf module.tar.gz ocean-prefilter ocean-prefilter-appimage packaging/appimages/deploy/ocean-prefilter*
# Docker stuff
BUILD_CMD = docker buildx build --pull $(BUILD_PUSH) --force-rm --no-cache --build-arg MAIN_TAG=$(MAIN_TAG) --build-arg BASE_TAG=$(BUILD_TAG) --platform linux/$(BUILD_TAG) -f $(BUILD_FILE) -t '$(MAIN_TAG):$(BUILD_TAG)' .
BUILD_PUSH = --load
BUILD_FILE = ./etc/Dockerfile.debian.bookworm
docker: docker-build docker-upload
docker-build: docker-arm64 docker-amd64
docker-upload: docker-upload-arm64 docker-upload-amd64
docker-arm64: MAIN_TAG = ghcr.io/viamrobotics/ocean-prefilter
docker-arm64: BUILD_TAG = arm64
docker-arm64:
$(BUILD_CMD)
docker-amd64: MAIN_TAG = ghcr.io/viamrobotics/ocean-prefilter
docker-amd64: BUILD_TAG = amd64
docker-amd64:
$(BUILD_CMD)
docker-upload-arm64:
docker push 'ghcr.io/viamrobotics/ocean-prefilter:arm64'
docker-upload-amd64:
docker push 'ghcr.io/viamrobotics/ocean-prefilter:amd64'
# CI targets that automatically push, avoid for local test-first-then-push workflows
docker-arm64-ci: MAIN_TAG = ghcr.io/viamrobotics/ocean-prefilter
docker-arm64-ci: BUILD_TAG = arm64
docker-arm64-ci: BUILD_PUSH = --push
docker-arm64-ci:
$(BUILD_CMD)
# CI targets that automatically push, avoid for local test-first-then-push workflows
docker-amd64-ci: MAIN_TAG = ghcr.io/viamrobotics/ocean-prefilter
docker-amd64-ci: BUILD_TAG = amd64
docker-amd64-ci: BUILD_PUSH = --push
docker-amd64-ci:
$(BUILD_CMD)
# Test target for running Go tests
test:
LD_LIBRARY_PATH=/usr/local/lib:/usr/lib go test ./oceanprefilter
# Docker image and container details
DOCKER_IMAGE := ghcr.io/viamrobotics/ocean-prefilter:arm64
# Lint rule
lint:
GOFLAGS="-buildvcs=false" golangci-lint run --timeout 10m ./