MikroTik Solutions

Makefile at trunk
Login

Makefile at trunk

File tinyproxy/Makefile artifact 3239015c9e on branch trunk


     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
# 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