simpler instructions

This commit is contained in:
Ruben ten Hove
2022-07-05 13:38:20 -04:00
parent dba24e8a3e
commit 3573a01dca
2 changed files with 19 additions and 13 deletions

View File

@@ -4,8 +4,8 @@ ENV IN_CONTAINER 1
RUN apk add --no-cache git sudo 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

View File

@@ -84,27 +84,33 @@ docker build --no-cache . -t stevenblack-hosts
Then run your command as such: Then run your command as such:
```sh ```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 > This will create the file, and remove it with the container when done, so not very
the container. Add `-v "${PWD}:/pwd" -w /pwd` after `-it` to mount your current working > useful. Use the following example to automatically update your hosts file in place.
directory, and have that as current working directory in your container.
#### Linux example #### 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). Just run the following command. Set extensions to your preference.
Then run the following command in that same directory. Set extensions to your preference.
```sh ```sh
docker run --pull always --rm -it -v /etc/hosts:/etc/hosts -v "${PWD}:/pwd" \ docker run --pull always --rm -it -v /etc/hosts:/etc/hosts \
-w /pwd ghcr.io/StevenBlack/hosts updateHostsFile.py --auto \ ghcr.io/StevenBlack/hosts updateHostsFile.py --auto \
--replace --extensions gambling porn --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 ### Option 2: Generate it in your own environment
To generate your own amalgamated hosts files you will need Python 3.6 or later. To generate your own amalgamated hosts files you will need Python 3.6 or later.