Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
423 lines (376 loc) · 21.9 KB
/
Copy pathMakefile
File metadata and controls
423 lines (376 loc) · 21.9 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
BINARY = pg
MODULE = github.com/mars-base/pgcli
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS = -s -w \
-X main.version=$(VERSION) \
-X main.buildTime=$(DATE)
PLATFORMS = linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
.PHONY: build clean test lint install build-all gencert container-build container-push container-build-minio container-push-minio container-build-mc container-push-mc container-build-patroni container-push-patroni container-build-rustfs container-push-rustfs container-build-predixy container-push-predixy container-build-influxdb container-push-influxdb container-build-influx2tsdb container-push-influx2tsdb container-build-documentdb-gateway container-push-documentdb-gateway container-build-mongosh container-push-mongosh container-build-privoxy container-manifest-privoxy container-push-privoxy container-save-privoxy container-images-export
build:
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) .
gencert:
go build -o bin/gencert ./tools/gencert
# Same install-directory rule as scripts/install.sh: /usr/local/bin when it is
# writable or passwordless sudo works, otherwise ~/.local/bin.
INSTALL_DIR ?= $(shell \
if [ -w /usr/local/bin ] 2>/dev/null; then echo /usr/local/bin; \
elif command -v sudo >/dev/null 2>&1 && sudo -n true 2>/dev/null; then echo /usr/local/bin; \
else echo "$$HOME/.local/bin"; fi)
install: build
@mkdir -p "$(INSTALL_DIR)" 2>/dev/null || sudo mkdir -p "$(INSTALL_DIR)"
@if [ -w "$(INSTALL_DIR)" ]; then \
install -m 0755 bin/$(BINARY) "$(INSTALL_DIR)/$(BINARY)"; \
else \
sudo install -m 0755 bin/$(BINARY) "$(INSTALL_DIR)/$(BINARY)"; \
fi
@echo " [OK] $(BINARY) installed to $(INSTALL_DIR)/$(BINARY)"
@case ":$$PATH:" in *":$(INSTALL_DIR):"*) ;; *) echo " NOTE: add $(INSTALL_DIR) to your PATH";; esac
build-all:
@for target in $(PLATFORMS); do \
os=$${target%/*}; \
arch=$${target#*/}; \
echo "Building $$os/$$arch..."; \
GOOS=$$os GOARCH=$$arch go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY)-$$os-$$arch . ; \
done
test:
go test ./...
lint:
golangci-lint run ./...
clean:
rm -rf bin/ dist/
container-build:
podman build --platform linux/amd64 -t ghcr.io/mars-base/pgcli/pgcli-pg:18-2.59.3-amd64 -f embed/Containerfile embed/
podman build --platform linux/arm64 -t ghcr.io/mars-base/pgcli/pgcli-pg:18-2.59.3-arm64 -f embed/Containerfile embed/
container-build-backup:
podman build --platform linux/amd64 -t ghcr.io/mars-base/pgcli/pgcli-backup:2.59.3-amd64 -f embed/backup.Containerfile embed/
podman build --platform linux/arm64 -t ghcr.io/mars-base/pgcli/pgcli-backup:2.59.3-arm64 -f embed/backup.Containerfile embed/
container-build-patroni:
podman build --http-proxy=false -t ghcr.io/mars-base/pgcli/pgcli-patroni:18-4.1.5 -f embed/patroni.Containerfile embed/
PRIVOXY_VERSION = 4.2.0
PRIVOXY_IMAGE = ghcr.io/mars-base/pgcli/pgcli-privoxy:$(PRIVOXY_VERSION)
container-build-privoxy:
podman build --http-proxy=false --platform linux/amd64 -t $(PRIVOXY_IMAGE)-amd64 -f embed/privoxy.Containerfile embed/
podman build --http-proxy=false --platform linux/arm64 -t $(PRIVOXY_IMAGE)-arm64 -f embed/privoxy.Containerfile embed/
container-manifest-privoxy:
podman manifest rm $(PRIVOXY_IMAGE) 2>/dev/null || true
podman manifest create $(PRIVOXY_IMAGE) \
containers-storage:$(PRIVOXY_IMAGE)-amd64 \
containers-storage:$(PRIVOXY_IMAGE)-arm64
container-push-privoxy:
podman manifest push $(PRIVOXY_IMAGE) $(PRIVOXY_IMAGE) --all
container-save-privoxy:
@mkdir -p images
podman pull --platform linux/amd64 $(PRIVOXY_IMAGE) >/dev/null 2>&1 \
|| podman image exists $(PRIVOXY_IMAGE) \
|| { echo "FAIL: cannot resolve $(PRIVOXY_IMAGE) (pull --platform amd64 failed and not in local store; login ghcr.io if private)" >&2; exit 1; }
podman save --format docker-archive -o images/pgcli-privoxy_$(PRIVOXY_VERSION).tar $(PRIVOXY_IMAGE)
container-manifest:
podman manifest rm ghcr.io/mars-base/pgcli/pgcli-pg:18-2.59.3 2>/dev/null || true
podman manifest create ghcr.io/mars-base/pgcli/pgcli-pg:18-2.59.3 \
containers-storage:ghcr.io/mars-base/pgcli/pgcli-pg:18-2.59.3-amd64 \
containers-storage:ghcr.io/mars-base/pgcli/pgcli-pg:18-2.59.3-arm64
podman manifest rm ghcr.io/mars-base/pgcli/pgcli-backup:2.59.3 2>/dev/null || true
podman manifest create ghcr.io/mars-base/pgcli/pgcli-backup:2.59.3 \
containers-storage:ghcr.io/mars-base/pgcli/pgcli-backup:2.59.3-amd64 \
containers-storage:ghcr.io/mars-base/pgcli/pgcli-backup:2.59.3-arm64
container-push:
podman manifest push ghcr.io/mars-base/pgcli/pgcli-pg:18-2.59.3 ghcr.io/mars-base/pgcli/pgcli-pg:18-2.59.3 --all
podman manifest push ghcr.io/mars-base/pgcli/pgcli-backup:2.59.3 ghcr.io/mars-base/pgcli/pgcli-backup:2.59.3 --all
podman push ghcr.io/mars-base/pgcli/pgcli-patroni:18-4.1.5 ghcr.io/mars-base/pgcli/pgcli-patroni:18-4.1.5
# Single-node MinIO image (public, referenced by config.DefaultMinioImageTag).
# Built from the upstream static binaries (minio/minio GitHub releases) on
# Alpine — the official MinIO image dropped the web console. Dual-arch
# (amd64+arm64) with a manifest list, so a pull-only install works on arm64
# hosts too (e.g. Apple Silicon podman VMs). The tag mirrors the release date;
# binaries are downloaded and sha256-verified by the target, never committed.
# The apk step and the alpine arm64 base pull need outbound network: prefix
# with HTTP_PROXY/HTTPS_PROXY if the build host routes through a proxy.
MINIO_VERSION ?= RELEASE.2025-04-22T22-12-26Z
# Compact timestamp tag (20250422221226): strip letters/dots/colons/dashes.
MINIO_TS := $(shell echo $(MINIO_VERSION) | tr -d 'A-Z.:-')
MINIO_IMAGE = ghcr.io/mars-base/pgcli/pgcli-minio:$(MINIO_TS)
MINIO_BASE = https://github.com/minio/minio/releases/download/$(MINIO_VERSION)
container-build-minio:
@for a in amd64 arm64; do \
curl -sfL --retry 3 -o embed/minio.linux-$$a $(MINIO_BASE)/minio.linux-$$a.$(MINIO_VERSION) || exit 1; \
curl -sfL --retry 3 -o /tmp/minio.linux-$$a.sha256sum $(MINIO_BASE)/minio.linux-$$a.$(MINIO_VERSION).sha256sum || exit 1; \
( cd embed && echo "$$(awk '{print $$1}' /tmp/minio.linux-$$a.sha256sum) minio.linux-$$a" | sha256sum -c ) || exit 1; \
chmod 0755 embed/minio.linux-$$a; \
mv embed/minio.linux-$$a embed/minio; \
podman build --platform linux/$$a --manifest $(MINIO_IMAGE) -t $(MINIO_IMAGE)-$$a -f embed/minio.Containerfile embed/ || exit 1; \
rm -f embed/minio; \
done
container-push-minio:
podman manifest push $(MINIO_IMAGE) $(MINIO_IMAGE) --all
# MinIO client image — a single static binary on scratch, ~30 MB per arch. The
# upstream binaries (minio/mc GitHub releases) are statically linked and
# stripped, so nothing to layer; only a TLS CA bundle is copied from the build
# host. Dual-arch (amd64+arm64) with a manifest tag — arm64 gives Apple Silicon
# hosts (podman machine VMs) native execution. Binaries are downloaded and
# sha256-verified by the target, never committed.
MC_VERSION ?= RELEASE.2025-08-13T08-35-41Z
# Compact timestamp tag, same style as the minio image (20250422221226):
# strip letters/dots/colons/dashes from RELEASE.2025-08-13T08-35-41Z.
MC_TS := $(shell echo $(MC_VERSION) | tr -d 'A-Z.:-')
MC_IMAGE = ghcr.io/mars-base/pgcli/pgcli-mc:$(MC_TS)
MC_BASE = https://github.com/minio/mc/releases/download/$(MC_VERSION)
container-build-mc:
cp /etc/ssl/certs/ca-certificates.crt embed/ca-certificates.crt
@for a in amd64 arm64; do \
curl -sfL --retry 3 -o embed/mc.linux-$$a $(MC_BASE)/mc.linux-$$a.$(MC_VERSION) || exit 1; \
curl -sfL --retry 3 -o /tmp/mc.linux-$$a.sha256sum $(MC_BASE)/mc.linux-$$a.$(MC_VERSION).sha256sum || exit 1; \
( cd embed && echo "$$(awk '{print $$1}' /tmp/mc.linux-$$a.sha256sum) mc.linux-$$a" | sha256sum -c ) || exit 1; \
chmod 0755 embed/mc.linux-$$a; \
mv embed/mc.linux-$$a embed/mc; \
podman build --platform linux/$$a --manifest $(MC_IMAGE) -t $(MC_IMAGE)-$$a -f embed/mc.Containerfile embed/ || exit 1; \
rm -f embed/mc; \
done
rm -f embed/ca-certificates.crt
container-push-mc:
podman manifest push $(MC_IMAGE) $(MC_IMAGE) --all
# rustfs wrapper image — the ONLY way pgcli runs rustfs (config.DefaultRustfsImageTag
# points here). Upstream rustfs bakes a fixed non-root user (uid/gid 10001), which
# under rootless podman forces a host-side ownership dance to pre-own bind mounts.
# This image removes that: its entrypoint starts as container-root, chowns the
# bind-mounted data/cert dirs to 10001, then `su`-drops to rustfs and execs the
# UNMODIFIED upstream /entrypoint.sh (see embed/rustfs-entrypoint.sh). pgcli then
# runs it with no --user flag and no host ownership code.
#
# The rustfs base is multi-arch, so — unlike the minio/mc targets that stage
# per-arch static binaries — there is nothing to download: just build the same
# thin wrapper once per arch (each build resolves the base for its own platform)
# and merge into a manifest. The tag mirrors the pinned upstream rustfs version.
RUSTFS_VERSION ?= 1.0.0
RUSTFS_BASE = docker.io/rustfs/rustfs:$(RUSTFS_VERSION)
RUSTFS_IMAGE = ghcr.io/mars-base/pgcli/pgcli-rustfs:$(RUSTFS_VERSION)
# `--manifest` APPENDS a per-arch entry to an existing manifest list (it does not
# replace), so without clearing first, re-running this target on the same host
# accumulates stale entries — a later `podman run` picks whichever entry the
# resolver visits first, potentially an older build. Drop the list (and the two
# per-arch tags) before rebuilding.
container-build-rustfs:
podman manifest rm $(RUSTFS_IMAGE) 2>/dev/null || true
podman rmi -f $(RUSTFS_IMAGE)-amd64 $(RUSTFS_IMAGE)-arm64 2>/dev/null || true
@for a in amd64 arm64; do \
podman build --platform linux/$$a --manifest $(RUSTFS_IMAGE) -t $(RUSTFS_IMAGE)-$$a \
--build-arg RUSTFS_BASE=$(RUSTFS_BASE) -f embed/rustfs.Containerfile embed/ || exit 1; \
done
container-push-rustfs:
podman manifest push $(RUSTFS_IMAGE) $(RUSTFS_IMAGE) --all
# Predixy proxy image — built from the upstream FREE-EDITION binary on Alpine.
# Upstream ships ONLY an amd64 glibc binary, so (unlike the dual-arch
# minio/mc/rustfs targets) this is a single-arch image with no manifest list;
# the tag carries a -alpine suffix to say so. The tarball's own license.conf is
# already expired (the free binary refuses to start with it), so we always
# overwrite it with the current license2026.conf from the release. The binary
# and extracted conf are downloaded and sha256-verified by the target, staged
# into embed/, and deleted after — never committed. The apk step and the alpine
# base pull need outbound network: prefix HTTP_PROXY/HTTPS_PROXY, or add
# `--network host` to the build line on a host whose default container network
# can't reach the alpine CDN (same caveat as the minio/mc targets above).
PREDIXY_VERSION ?= 7.0.1
PREDIXY_IMAGE = ghcr.io/mars-base/pgcli/predixy:$(PREDIXY_VERSION)-alpine
PREDIXY_BASE = https://github.com/joyieldInc/predixy/releases/download/$(PREDIXY_VERSION)
PREDIXY_LICENSE_SHA256 ?= 04390ed707c305a64827b61e5ce71f1d2c53e850ccb30c769e6c74957c2be400
container-build-predixy:
@curl -sfL --retry 3 -o /tmp/predixy.tar.gz $(PREDIXY_BASE)/predixyFreeEdition-$(PREDIXY_VERSION)-amd64-linux.tar.gz || exit 1
@rm -rf /tmp/predixy-ex && mkdir -p /tmp/predixy-ex && tar xzf /tmp/predixy.tar.gz -C /tmp/predixy-ex
@cp /tmp/predixy-ex/predixyFreeEdition-$(PREDIXY_VERSION)/bin/predixy embed/predixy
@rm -rf embed/predixy-conf && cp -r /tmp/predixy-ex/predixyFreeEdition-$(PREDIXY_VERSION)/conf embed/predixy-conf
@curl -sfL --retry 3 -o embed/predixy-conf/license.conf $(PREDIXY_BASE)/license2026.conf || exit 1
@echo "$(PREDIXY_LICENSE_SHA256) embed/predixy-conf/license.conf" | sha256sum -c - || exit 1
@podman build --platform linux/amd64 -t $(PREDIXY_IMAGE) -f embed/predixy.Containerfile embed/
@rm -f embed/predixy
@rm -rf embed/predixy-conf
@rm -rf /tmp/predixy.tar.gz /tmp/predixy-ex
container-push-predixy:
podman push $(PREDIXY_IMAGE) $(PREDIXY_IMAGE)
# InfluxDB 1.13.1 image — single-node OSS on Alpine, packaging the official
# linux/amd64 release tarball (influxd + influx + influx_inspect). Single-arch:
# the addon targets Linux x86 only. INFLUXDB_PACKAGE may point at a local copy
# of the tarball for offline builds; the sha256 is verified either way.
INFLUXDB_VERSION ?= 1.13.1
INFLUXDB_IMAGE = ghcr.io/mars-base/pgcli/pgcli-influxdb:$(INFLUXDB_VERSION)
INFLUXDB_URL = https://dl.influxdata.com/influxdb/releases/v$(INFLUXDB_VERSION)/influxdb-$(INFLUXDB_VERSION)_linux_amd64.tar.gz
INFLUXDB_SHA256 ?= a8a6e648f5271e3286bc965a2d321c86c6404afaa12ca4bf37c44303e0bf2f52
INFLUXDB_PACKAGE ?=
container-build-influxdb:
@src="$(INFLUXDB_PACKAGE)"; \
if [ -z "$$src" ]; then \
src=/tmp/influxdb-$(INFLUXDB_VERSION)_linux_amd64.tar.gz; \
curl -sfL --retry 3 -o "$$src" $(INFLUXDB_URL) || exit 1; \
fi; \
echo "$(INFLUXDB_SHA256) $$src" | sha256sum -c - || exit 1; \
rm -rf /tmp/influxdb-ex && mkdir -p /tmp/influxdb-ex; \
tar xzf "$$src" -C /tmp/influxdb-ex || exit 1; \
d=$$(find /tmp/influxdb-ex -mindepth 1 -maxdepth 1 -type d -name 'influxdb-*' | head -n1); \
[ -n "$$d" ] || { echo "influxdb package layout not recognised" >&2; exit 1; }; \
cp "$$d/influxd" "$$d/influx" "$$d/influx_inspect" "$$d/influxdb.conf" embed/ || exit 1; \
chmod 0755 embed/influxd embed/influx embed/influx_inspect; \
podman build --platform linux/amd64 -t $(INFLUXDB_IMAGE) -f embed/influxdb.Containerfile embed/; \
rc=$$?; rm -f embed/influxd embed/influx embed/influx_inspect embed/influxdb.conf; \
rm -rf /tmp/influxdb-ex; exit $$rc
container-push-influxdb:
podman push $(INFLUXDB_IMAGE) $(INFLUXDB_IMAGE)
# influx2tsdb-proxy image — a single static Go binary from the upstream
# linux/amd64 release asset. Single-arch: the addon targets Linux x86 only.
# INFLUX2TSDB_BINARY may point at a local copy of the release binary for
# offline builds; the sha256 is verified either way.
INFLUX2TSDB_VERSION ?= 1.3.2
INFLUX2TSDB_IMAGE = ghcr.io/mars-base/pgcli/pgcli-influx2tsdb:$(INFLUX2TSDB_VERSION)
INFLUX2TSDB_URL = https://github.com/mars-base/influx2tsdb-proxy/releases/download/v$(INFLUX2TSDB_VERSION)/influx2tsdb-proxy-linux-amd64
INFLUX2TSDB_SHA256 ?= 83d9e79c716e20a67b56265781cc2222ea37077c7793736ebb2bfb996f0e7481
INFLUX2TSDB_BINARY ?=
container-build-influx2tsdb:
@src="$(INFLUX2TSDB_BINARY)"; \
if [ -z "$$src" ]; then \
src=/tmp/influx2tsdb-proxy-linux-amd64; \
curl -sfL --retry 3 -o "$$src" $(INFLUX2TSDB_URL) || exit 1; \
fi; \
echo "$(INFLUX2TSDB_SHA256) $$src" | sha256sum -c - || exit 1; \
cp "$$src" embed/ && chmod 0755 embed/influx2tsdb-proxy-linux-amd64 || exit 1; \
podman build --platform linux/amd64 -t $(INFLUX2TSDB_IMAGE) -f embed/influx2tsdb.Containerfile embed/; \
rc=$$?; rm -f embed/influx2tsdb-proxy-linux-amd64; exit $$rc
container-push-influx2tsdb:
podman push $(INFLUX2TSDB_IMAGE) $(INFLUX2TSDB_IMAGE)
# DocumentDB gateway image — the official Rust MongoDB wire-protocol gateway
# from the upstream .deb, on debian:13-slim (glibc 2.39+). Dual-arch with a
# manifest list, same shape as minio/mc. The daemon is started directly: the
# upstream /usr/bin wrapper's systemd/runuser logic is bypassed, and the add-on
# mounts a SetupConfiguration.json with telemetry explicitly disabled.
DOCDB_GW_VERSION ?= 1.0.0
DOCDB_GW_RELEASE ?= v1.0-0
DOCDB_GW_IMAGE = ghcr.io/mars-base/pgcli/pgcli-documentdb-gateway:$(DOCDB_GW_VERSION)
DOCDB_GW_BASE = https://github.com/documentdb/documentdb/releases/download/$(DOCDB_GW_RELEASE)
DOCDB_GW_SHA256_amd64 ?= dffa4320c001dd4f586210c86417a68d6caa3ffd4ff8cb88c83d1eb11944c4c1
DOCDB_GW_SHA256_arm64 ?= 69ddd3b9c03c6418bd458804b2abb6de38e55553ac0a60bc0234a3aefce9d3c4
container-build-documentdb-gateway:
@for a in amd64 arm64; do \
case $$a in \
amd64) sha=$(DOCDB_GW_SHA256_amd64);; \
arm64) sha=$(DOCDB_GW_SHA256_arm64);; \
esac; \
deb=/tmp/documentdb-gateway_$(DOCDB_GW_VERSION)_$$a.deb; \
curl -sfL --retry 3 -o $$deb $(DOCDB_GW_BASE)/ubuntu24.04-documentdb-gateway_$(DOCDB_GW_VERSION)_$$a.deb || exit 1; \
echo "$$sha $$deb" | sha256sum -c - || exit 1; \
cp $$deb embed/documentdb-gateway.deb || exit 1; \
podman build --platform linux/$$a --manifest $(DOCDB_GW_IMAGE) -t $(DOCDB_GW_IMAGE)-$$a -f embed/documentdb-gateway.Containerfile embed/ || exit 1; \
rm -f embed/documentdb-gateway.deb; \
done
container-push-documentdb-gateway:
podman manifest push $(DOCDB_GW_IMAGE) $(DOCDB_GW_IMAGE) --all
# mongosh client image — only the official mongosh binary (Node SEA release
# tarball) on debian:13-slim, no MongoDB server. Used on demand by
# `pg addon documentdb shell|databases|collections|indexes`; pgcli pulls it only
# when one of those commands runs, so nothing is added to the pgcli binary.
# Dual-arch with a manifest list, same shape as minio/mc. Only bin/mongosh is
# kept (the 92 MB crypt shared object is intentionally dropped: pgcli never
# uses client-side field encryption). The binary is stripped when the host
# strip supports the target arch; cross-arch failures keep the original.
MONGOSH_VERSION ?= 2.14.1
MONGOSH_IMAGE = ghcr.io/mars-base/pgcli/pgcli-mongosh:$(MONGOSH_VERSION)
MONGOSH_BASE = https://downloads.mongodb.com/compass
MONGOSH_ARCHS ?= amd64 arm64
MONGOSH_SHA256_amd64 ?= 8d24940ebe3675959b518fd41ea16b4e2182d6a75c09777db09cfa64e18834a1
MONGOSH_SHA256_arm64 ?= cd7f1ae986baa400b021a2c0688aa3b64d6afcc3f7ab07833417a049e0cbf98b
container-build-mongosh:
@for a in $(MONGOSH_ARCHS); do \
case $$a in \
amd64) a2=x64; sha=$(MONGOSH_SHA256_amd64);; \
arm64) a2=arm64; sha=$(MONGOSH_SHA256_arm64);; \
*) echo "unsupported arch: $$a" >&2; exit 1;; \
esac; \
tgz=/tmp/mongosh-$(MONGOSH_VERSION)-linux-$$a2.tgz; \
curl -sfL --retry 3 -o $$tgz $(MONGOSH_BASE)/mongosh-$(MONGOSH_VERSION)-linux-$$a2.tgz || exit 1; \
echo "$$sha $$tgz" | sha256sum -c - || exit 1; \
rm -rf /tmp/mongosh-ex; mkdir -p /tmp/mongosh-ex; \
tar xzf $$tgz -C /tmp/mongosh-ex || exit 1; \
d=$$(find /tmp/mongosh-ex -mindepth 1 -maxdepth 1 -type d -name 'mongosh-*' | head -n1); \
[ -n "$$d" ] || { echo "mongosh package layout not recognised" >&2; exit 1; }; \
cp "$$d/bin/mongosh" embed/mongosh || exit 1; \
if ! strip embed/mongosh 2>/dev/null; then cp "$$d/bin/mongosh" embed/mongosh; fi; \
chmod 0755 embed/mongosh; \
podman build --platform linux/$$a --manifest $(MONGOSH_IMAGE) -t $(MONGOSH_IMAGE)-$$a -f embed/mongosh.Containerfile embed/ || exit 1; \
rm -f embed/mongosh; \
done
container-push-mongosh:
podman manifest push $(MONGOSH_IMAGE) $(MONGOSH_IMAGE) --all
# Offline image export for the docs/images.md catalog (see that doc's
# "镜像导出" section for the manual equivalents and the rustfs/redis
# manifest-list caveat). Always pulls --platform linux/amd64 FIRST so a
# multi-arch manifest-list tag in the local store (e.g. pgcli-rustfs) is
# normalized to a single-arch image before `podman save` — docker-archive
# format refuses manifest lists. Tars land in ./images/ (gitignored) named
# <repo>_<tag>.tar with canonical RepoTags, so `podman load` on the target
# yields the exact reference pgcli expects — no retagging there. The ghcr.io
# mars-base images are private: `podman login ghcr.io` must have happened
# first (or pull is skipped when the image is already local).
# Keep this list in sync with docs/images.md.
IMAGES := \
ghcr.io/mars-base/pgcli/pgcli-pg:18-2.59.3 \
ghcr.io/mars-base/pgcli/pgcli-patroni:18-4.1.5 \
ghcr.io/mars-base/pgcli/pgcli-backup:2.59.3 \
ghcr.io/mars-base/pgcli/pgcli-minio:20250422221226 \
ghcr.io/mars-base/pgcli/pgcli-mc:20250813083541 \
ghcr.io/mars-base/pgcli/pgcli-rustfs:1.0.0 \
ghcr.io/mars-base/pgcli/pgcli-influxdb:1.13.1 \
ghcr.io/mars-base/pgcli/pgcli-influx2tsdb:1.3.2 \
ghcr.io/mars-base/pgcli/pgcli-documentdb-gateway:1.0.0 \
ghcr.io/mars-base/pgcli/pgcli-mongosh:2.14.1 \
ghcr.io/mars-base/pgcli/predixy:7.0.1-alpine \
docker.io/pgsty/silo:RELEASE.2026-09-16T00-00-00Z \
docker.io/postgrest/postgrest:v16.3 \
docker.io/edoburu/pgbouncer:v1.25.2-p0 \
docker.io/library/haproxy:3.2.23-alpine \
quay.io/coreos/etcd:v3.5.30 \
ghcr.io/pgdogdev/pgdog:v0.1.57 \
docker.io/library/redis:7.4.11 \
docker.io/library/redis:8.10.2 \
docker.io/valkey/valkey:7.2.16 \
docker.io/valkey/valkey:8.1.12 \
docker.io/valkey/valkey:9.2.0 \
docker.io/dpage/pgadmin4:9.18 \
docker.io/library/nginx:1.27-alpine \
ghcr.io/mars-base/pgcli/pgcli-privoxy:4.2.0 \
docker.io/dxflrs/garage:v2.4.1 \
docker.io/chrislusf/seaweedfs:4.48_large_disk \
docker.io/grafana/grafana:13.2.4 \
docker.io/prom/prometheus:v3.15.0 \
docker.io/prom/alertmanager:v0.34.1 \
docker.io/gitea/gitea:28.1.0 \
ghcr.io/thinkparq/beegfs-mgmtd:8.4.0 \
ghcr.io/thinkparq/beegfs-meta:8.4.0 \
ghcr.io/thinkparq/beegfs-storage:8.4.0 \
docker.io/victoriametrics/victoria-metrics:v1.154.1 \
docker.io/victoriametrics/vminsert:v1.154.1-cluster \
docker.io/victoriametrics/vmselect:v1.154.1-cluster \
docker.io/victoriametrics/vmstorage:v1.154.1-cluster \
docker.io/victoriametrics/victoria-logs:v1.53.0 \
docker.io/victoriametrics/vlagent:v1.53.0 \
docker.io/victoriametrics/vmalert:v1.133.0 \
docker.io/clickhouse/clickhouse-server:26.8.36.3 \
docker.io/clickhouse/clickhouse-keeper:26.8.36.3 \
docker.io/apache/kafka:4.4.0 \
docker.io/library/rabbitmq:4.4.0-management \
docker.io/apache/rocketmq:5.5.0 \
docker.io/prom/node-exporter:v1.12.1 \
docker.io/pgsty/pg_exporter:1.5.0 \
docker.io/chaitin/safeline-postgres:15.18 \
docker.io/chaitin/safeline-mgt:9.4.7 \
docker.io/chaitin/safeline-detector:9.4.7 \
docker.io/chaitin/safeline-tengine:9.4.7 \
docker.io/chaitin/safeline-luigi:9.4.7 \
docker.io/chaitin/safeline-fvm:9.4.7 \
docker.io/chaitin/safeline-chaos:9.4.7
container-images-export:
@mkdir -p images
@for img in $(IMAGES); do \
tar=images/$$(echo $${img##*/} | tr : _).tar; \
if [ -f $$tar ]; then echo "SKIP $$tar (already exported)"; continue; fi; \
podman pull --platform linux/amd64 $$img >/dev/null 2>&1 \
|| podman image exists $$img \
|| { echo "FAIL: cannot resolve $$img (pull --platform amd64 failed and not in local store; login ghcr.io if private)" >&2; exit 1; }; \
podman save --format docker-archive -o $$tar $$img || exit 1; \
echo "OK $$tar <- $$img"; \
done