diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d8239fe..60584df 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -37,5 +37,5 @@ ENTRYPOINT [ "/usr/local/share/docker-init.sh" ] CMD [ "sleep", "infinity" ] # [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends \ No newline at end of file +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends make \ No newline at end of file diff --git a/.gitignore b/.gitignore index 830f56e..7a9ac5f 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,6 @@ $RECYCLE.BIN/ *.lnk # End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux + +# Custom dir for test +tests/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..33c15a3 --- /dev/null +++ b/Makefile @@ -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