build: set up Makefile

This commit is contained in:
Mogeko 2021-11-18 00:14:34 +00:00
parent 032219bee2
commit 54fe139a46
No known key found for this signature in database
GPG key ID: B35485A88F40AD2C
3 changed files with 39 additions and 2 deletions

View file

@ -37,5 +37,5 @@ ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD [ "sleep", "infinity" ] CMD [ "sleep", "infinity" ]
# [Optional] Uncomment this section to install additional OS packages. # [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here> && apt-get -y install --no-install-recommends make

3
.gitignore vendored
View file

@ -73,3 +73,6 @@ $RECYCLE.BIN/
*.lnk *.lnk
# End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux # End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux
# Custom dir for test
tests/

34
Makefile Normal file
View file

@ -0,0 +1,34 @@
CMD = /usr/bin/docker
IMAGE = mogeko/qbittorrent
VERSION = 4.3.8
PORT = 8080
CONF_DIR = $(shell pwd)/tests/config
DL_DIR = $(shell pwd)/tests/data
.PHONY: all build run help
all: build run
build:
@$(CMD) build . \
--build-arg VERSION=$(VERSION) \
--tag $(IMAGE)
run: id := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ")
run:
@-$(CMD) run -it \
--name qbt-$(id) \
-p 6881:6881 \
-p 6881:6881/udp \
-p $(PORT):8080 \
-v $(CONF_DIR):/config \
-v $(DL_DIR):/downloads \
$(IMAGE)
@$(CMD) rm -f qbt-$(id)
help: id := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ")
help:
@-$(CMD) run -it --name qbt-$(id) $(IMAGE) --help
@$(CMD) rm -f qbt-$(id)
rm: clean