From: Ruben ten Hove Date: Tue, 5 Jul 2022 17:38:20 +0000 (-0400) Subject: simpler instructions X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=3573a01dca4d98aed0453a231cfd77bbf3e9c35d;p=stevenblack-hosts.git simpler instructions --- diff --git a/Dockerfile b/Dockerfile index 11fa72ae6..72c749735 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,8 @@ ENV IN_CONTAINER 1 RUN apk add --no-cache git sudo -COPY . /usr/src/hosts +COPY . /hosts -RUN pip install --no-cache-dir --upgrade -r /usr/src/hosts/requirements.txt +RUN pip install --no-cache-dir --upgrade -r /hosts/requirements.txt -ENV PATH $PATH:/usr/src/hosts +ENV PATH $PATH:/hosts diff --git a/readme_template.md b/readme_template.md index e8bd43172..1dd10d2a7 100644 --- a/readme_template.md +++ b/readme_template.md @@ -84,27 +84,33 @@ docker build --no-cache . -t stevenblack-hosts Then run your command as such: ```sh -docker run --rm -it -v "${PWD}/test:/pwd" stevenblack-hosts updateHostsFile.py +docker run --rm -it ghcr.io/StevenBlack/hosts updateHostsFile.py ``` -> It is recommended to mount a host directory, so your changes are saved when you exit -the container. Add `-v "${PWD}:/pwd" -w /pwd` after `-it` to mount your current working -directory, and have that as current working directory in your container. +> This will create the file, and remove it with the container when done, so not very +> useful. Use the following example to automatically update your hosts file in place. #### Linux example -This will replace your `/etc/hosts` and optionally add any custom hosts. +This will replace your `/etc/hosts`. -(Optionally) First create custom hosts files as per [the instructions](#how-do-i-control-which-sources-are-unified). - -Then run the following command in that same directory. Set extensions to your preference. +Just run the following command. Set extensions to your preference. ```sh -docker run --pull always --rm -it -v /etc/hosts:/etc/hosts -v "${PWD}:/pwd" \ --w /pwd ghcr.io/StevenBlack/hosts updateHostsFile.py --auto \ +docker run --pull always --rm -it -v /etc/hosts:/etc/hosts \ +ghcr.io/StevenBlack/hosts updateHostsFile.py --auto \ --replace --extensions gambling porn ``` +If you want to add custom hosts or a whitelist, create either ot both files as per +[the instructions](#how-do-i-control-which-sources-are-unified) and add the following +arguments _before_ `ghcr.io/StevenBlack/hosts` depending on which you wish to use. + +```sh +-v "path/to/myhosts:/hosts/myhosts" \ +-v "path/to/whitelist:/hosts/whitelist" +``` + ### Option 2: Generate it in your own environment To generate your own amalgamated hosts files you will need Python 3.6 or later.