# 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