This repository was archived by the owner on Feb 18, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
118 lines (86 loc) · 3.19 KB
/
Makefile
File metadata and controls
118 lines (86 loc) · 3.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
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
111
112
113
114
115
116
117
118
VERSION ?= $(shell git rev-parse --short=8 HEAD)
BUILD_DIR := build
BOOTSTRAP := $(BUILD_DIR)/bootstrap
REGISTRY := ghcr.io/beetlebugorg/go-dims
BINARY := $(BUILD_DIR)/dims
LAMBDA_BINARY := $(BUILD_DIR)/bootstrap
LD_FLAGS = "-X 'github.com/beetlebugorg/go-dims/internal/dims/core.Version=${VERSION}'"
STATIC_LDFLAGS = "-X 'github.com/beetlebugorg/go-dims/internal/dims/core.Version=${VERSION}' -linkmode 'external' -extldflags '-fno-PIC -static -Wl,-z,stack-size=8388608 -lpng -lz -ltiff -lwebp -lwebpmux -lwebpdemux -ljpeg -lbz2 -lexpat -llcms2 -lgomp -lsharpyuv'"
# -- Build targets
# Builds the shared library version of dims
all:
go generate ./...
go build -o $(BINARY) -ldflags $(LD_FLAGS) ./cmd/dims
# Builds a static binary version of dims
static:
go generate ./...
go build -o $(BINARY) -ldflags $(STATIC_LDFLAGS) ./cmd/dims
binary-amd64:
docker buildx build \
--platform linux/amd64 \
--build-arg TARGETARCH=amd64 \
-f Dockerfile.binaries \
--output type=local,dest=build .
binary-arm64:
docker buildx build \
--platform linux/arm64 \
--build-arg TARGETARCH=arm64 \
-f Dockerfile.binaries \
--output type=local,dest=build .
#-- Lambda targets
lambda:
go generate ./...
go build -o $(LAMBDA_BINARY) -tags "lambda.norpc lambda" -ldflags $(STATIC_LDFLAGS) ./cmd/dims
cd $(BUILD_DIR) && zip lambda.zip bootstrap
lambda-amd64:
docker buildx build \
--platform linux/amd64 \
--build-arg TARGETARCH=amd64 \
-f Dockerfile.lambda \
--output type=local,dest=build .
lambda-arm64:
docker buildx build \
--platform linux/arm64 \
--build-arg TARGETARCH=arm64 \
-f Dockerfile.lambda \
--output type=local,dest=build .
deploy-lambda-arm64: lambda-arm64
cd terraform && terraform apply -auto-approve
#-- Documentation targets
docs:
mdbook build docs
docs-serve:
mdbook serve docs
#-- Dockerfile targets
docker:
docker build -t ${REGISTRY}:local .
docker images | grep ${REGISTRY}
docker-run: docker
docker run -it --rm ${REGISTRY}:local /bin/sh
libpng:
docker buildx build --target libpng --load -t ${REGISTRY}:libpng -f Dockerfile.builder .
libpng-run: libpng
docker run -it --rm ${REGISTRY}:libpng /bin/sh
libtiff:
docker buildx build --target libtiff --load -t ${REGISTRY}:libtiff -f Dockerfile.builder .
libtiff-run: libtiff
docker run --load -t ${REGISTRY}:libtiff /bin/sh
libwebp:
docker buildx build --target libwebp --load -t ${REGISTRY}:libwebp -f Dockerfile.builder .
libwebp-run: libwebp
docker run --load -t ${REGISTRY}:libwebp /bin/sh
glib:
docker buildx build --target glib --load -t ${REGISTRY}:glib -f Dockerfile.builder .
glib-run: glib
docker run --load -t ${REGISTRY}:glib /bin/sh
libvips:
docker buildx build --target libvips --load -t ${REGISTRY}:libvips -f Dockerfile.builder .
libvips-run: libvips
docker run -it --rm ${REGISTRY}:libvips /bin/sh
builder:
docker buildx build --push --platform linux/amd64,linux/arm64 -t ${REGISTRY}:builder -f Dockerfile.builder .
builder-local:
docker buildx build --load -t ${REGISTRY}:builder-local -f Dockerfile.builder .
builder-local-run: builder-local
docker run -it --rm -v .:/build/go-dims ${REGISTRY}:builder-local /bin/sh
.PHONY: docs docs-serve