MikroTik Solutions

Artifact [3dc582496d]
Login

Artifact [3dc582496d]

Artifact 3dc582496d9e7a159cee3e9e1c56a0744223aadacdac7d886d3de14c6af71e09:


# Container base name
NAME := speedtest-cli
TARBALL := $(NAME).tar

# Upstream version to base this image on.  Find new versions here:
# https://www.speedtest.net/apps/cli
VERSION := 1.2.0
URIBASE := https://install.speedtest.net/app/cli/ookla-speedtest-$(VERSION)-linux

# Image repo prefix to use for "push"
IMGREPO := tangentsoft

# Versioned names to shorten commands below
VDNAME  := $(NAME)-$(VERSION)
LVINAME := $(NAME):$(VERSION)
RVINAME := $(IMGREPO)/$(LVINAME)
RNINAME := $(IMGREPO)/$(NAME):latest
MACHINE := $(shell uname -m)

# Container engine to use; "podman" also works here.
CENGINE := docker

# The list of platforms we build the container for.  It should cover 99%
# of all practical use cases.  See archmap for the translation to the
# platform names Ookla uses in their tarballs.
PLATFORMS := linux/x86_64,linux/i386,linux/arm/v7,linux/arm64

# Create OCI image in build cache
$(TARBALL): Dockerfile Makefile
	$(CENGINE) build \
		--build-arg URIBASE=$(URIBASE) \
		--platform $(PLATFORMS) \
		--tag $(NAME):latest \
		--tag $(LVINAME) \
		--tag $(RNINAME) \
		--tag $(RVINAME) \
		$(DBFLAGS) .
	$(CENGINE) image save $(LVINAME) > $@

# Remove build outputs
clean:
	rm -f $(TARBALL)
	-$(CENGINE) image rm $(LVINAME)
	-$(CENGINE) image rm $(NAME):latest

login:
	$(CENGINE) login

# Push the built container bundle
push: $(TARBALL)
	$(CENGINE) push $(RNINAME)
	$(CENGINE) push $(RVINAME)

# Run the native version of the built container locally, for testing
run: $(TARBALL)
	$(CENGINE) run $(DRFLAGS) \
		--rm \
		--tty \
		--interactive \
		$(LVINAME) $(EPFLAGS)