wip - v1 => It's working !! #1
@@ -1,6 +1,6 @@
 | 
				
			|||||||
FROM alpine:latest
 | 
					FROM alpine:latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN apk add --no-cache curl bash busybox-cron
 | 
					RUN apk add --no-cache curl bash busybox-cron tzdata
 | 
				
			||||||
 | 
					
 | 
				
			||||||
COPY update-blocklist.sh /usr/local/bin/update-blocklist.sh
 | 
					COPY update-blocklist.sh /usr/local/bin/update-blocklist.sh
 | 
				
			||||||
COPY entrypoint.sh /entrypoint.sh
 | 
					COPY entrypoint.sh /entrypoint.sh
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,9 +28,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
| Variable            | Description                                                | Default                           |
 | 
					| Variable            | Description                                                | Default                           |
 | 
				
			||||||
| ------------------- | ---------------------------------------------------------- | --------------------------------- |
 | 
					| ------------------- | ---------------------------------------------------------- | --------------------------------- |
 | 
				
			||||||
 | 
					| `TZ`    | Your Time Zone    | (required) |
 | 
				
			||||||
| `BLOCK_COUNTRIES`   | Comma-separated country codes to block (e.g., `CN,RU,IR`)  | (required)                        |
 | 
					| `BLOCK_COUNTRIES`   | Comma-separated country codes to block (e.g., `CN,RU,IR`)  | (required)                        |
 | 
				
			||||||
| `BLOCKLIST_CRON`    | Cron expression for update frequency (e.g., `0 6 * * *`) | `0 6 * * *` (at 6:00 everydays)          |
 | 
					| `BLOCKLIST_CRON`    | Cron expression for update frequency (e.g., `0 6 * * *`) | `0 6 * * *` (at 6:00 everydays)          |
 | 
				
			||||||
| `DOCKER_API_URL`    | URL of Docker socket proxy to restart AdGuard container    | `http://docker-socket-proxy:2375` |
 | 
					| `DOCKER_API_URL`    | URL of Docker socket proxy to restart AdGuard container    | `tcp://socket-proxy-adguard:2375` |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## File Structure
 | 
					## File Structure
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,9 +3,10 @@ services:
 | 
				
			|||||||
  adguard-cidre:
 | 
					  adguard-cidre:
 | 
				
			||||||
    build: .
 | 
					    build: .
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
 | 
					      - TZ=Europe/Paris # change to your timezone
 | 
				
			||||||
      - BLOCK_COUNTRIES=CN,RU,IR # choose countries listed IP to block. Full lists here https://github.com/vulnebify/cidre/tree/main/output/cidr/ipv4
 | 
					      - BLOCK_COUNTRIES=CN,RU,IR # choose countries listed IP to block. Full lists here https://github.com/vulnebify/cidre/tree/main/output/cidr/ipv4
 | 
				
			||||||
      - BLOCKLIST_CRON=0 6 * * * # at 6:00 every days
 | 
					      - BLOCKLIST_CRON=0 6 * * * # at 6:00 every days
 | 
				
			||||||
      - DOCKER_API_URL=http://socket-proxy-adguard:2375
 | 
					      - DOCKER_API_URL=tcp://socket-proxy-adguard:2375
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - /path/to/adguard/confdir:/adguard
 | 
					      - /path/to/adguard/confdir:/adguard
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
set -e
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -n "$TZ" ]; then
 | 
				
			||||||
 | 
					  cp /usr/share/zoneinfo/$TZ /etc/localtime
 | 
				
			||||||
 | 
					  echo "$TZ" > /etc/timezone
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CRON_EXPR="${BLOCKLIST_CRON:-"0 6 * * *"}" # default: every hour
 | 
					CRON_EXPR="${BLOCKLIST_CRON:-"0 6 * * *"}" # default: every hour
 | 
				
			||||||
SCRIPT_PATH="/usr/local/bin/update-blocklist.sh"
 | 
					SCRIPT_PATH="/usr/local/bin/update-blocklist.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ TMP_YAML="/tmp/AdGuardHome.yaml"
 | 
				
			|||||||
MANUAL_IPS_FILE="/adguard/manually_blocked_ips.conf"
 | 
					MANUAL_IPS_FILE="/adguard/manually_blocked_ips.conf"
 | 
				
			||||||
CIDR_BASE_URL="https://raw.githubusercontent.com/vulnebify/cidre/main/output/cidr/ipv4"
 | 
					CIDR_BASE_URL="https://raw.githubusercontent.com/vulnebify/cidre/main/output/cidr/ipv4"
 | 
				
			||||||
COUNTRIES=${BLOCK_COUNTRIES:-""}
 | 
					COUNTRIES=${BLOCK_COUNTRIES:-""}
 | 
				
			||||||
DOCKER_API_URL=${DOCKER_API_URL:-"http://docker-socket-proxy:2375"}
 | 
					DOCKER_API_URL=${DOCKER_API_URL:-"tcp://socket-proxy-adguard:2375"}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -z "$COUNTRIES" ]; then
 | 
					if [ -z "$COUNTRIES" ]; then
 | 
				
			||||||
  echo "No countries specified in BLOCK_COUNTRIES."
 | 
					  echo "No countries specified in BLOCK_COUNTRIES."
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user