MikroTik Solutions

Artifact [3239015c9e]
Login

Artifact [3239015c9e]

Artifact 3239015c9e143691fa9a483dbcca90ee808be4f3d5e86060ce5248e4124c5c9c:


# Container base name
NAME := tinyproxy
TARBALL := $(NAME).tar

# Version to clone and build.  You can use any valid tag on the upstream
# https://github.com/tinyproxy/tinyprox repo.
VERSION := 1.11.2

# Image repo prefix to use for "push"
IMGREPO := tangentsoft
LNINAME := $(IMGREPO)/$(NAME):latest
LVINAME := $(IMGREPO)/$(NAME):v$(VERSION)

# The list of platforms we build the container for.  It should cover 99%
# of all practical use cases.
PLATFORMS := linux/x86_64,linux/i386,linux/arm,linux/arm64

# Create OCI image in build cache
$(TARBALL): Dockerfile Makefile
	docker build \
		--build-arg VERSION=$(VERSION) \
		--platform $(PLATFORMS) \
		--tag $(LNINAME) \
		--tag $(LVINAME) \
		$(DBFLAGS) .
	rm -f $@
	docker image save $(LVINAME) > $@.tmp
	skopeo copy docker-archive:$@.tmp docker-archive:$@
	rm $@.tmp

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

login:
	docker login

# Push the built container bundle
push: $(TARBALL)
	docker push $(LNINAME)
	docker push $(LVINAME)

# Run the native version of the built container locally, for testing
run:
	-docker rm -f tinyproxy-run-temp > /dev/null 2>&1	# cleanup after last run
	docker create $(DCFLAGS) \
		--tty \
		--interactive \
		--name tinyproxy-run-temp \
		--publish 8888:8888/tcp \
		$(LVINAME)
	docker cp tinyproxy.conf tinyproxy-run-temp:/etc
	docker start -ai $(DRFLAGS) tinyproxy-run-temp $(DRARGS)
	docker rm tinyproxy-run-temp