From e73e9364cd97cc908b30164ca06eb0d710e6532f Mon Sep 17 00:00:00 2001 From: Yasuaki Uechi Date: Sat, 5 Feb 2022 12:40:04 +0900 Subject: [PATCH] add cron --- .gitignore | 1 + Dockerfile | 2 +- Makefile | 7 ++++--- docker-compose.production.yml | 12 +++++++++++- periodic/daily/280blocker | 6 ++++++ 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100755 periodic/daily/280blocker diff --git a/.gitignore b/.gitignore index 3e70239..2d11984 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /data/ + /.vscode /.sass-cache /node_modules/ diff --git a/Dockerfile b/Dockerfile index c25ec88..fbc8d5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,4 +16,4 @@ RUN yarn build FROM nginx:stable-alpine as runtime COPY nginx.conf /etc/nginx/nginx.conf -COPY --from=build /app/public /var/www/html/ +COPY --from=build /app/public /var/www/html/ \ No newline at end of file diff --git a/Makefile b/Makefile index 2dd62c8..e46d39f 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ +deploy: build + docker rm -f uechi.io uechi.io-cron + docker-compose -f docker-compose.production.yml up -d + build: docker-compose build --pull push: docker-compose push -deploy: build - docker rm -f uechi.io - docker-compose -f docker-compose.production.yml up -d diff --git a/docker-compose.production.yml b/docker-compose.production.yml index c655b9a..6ccbafa 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -9,7 +9,17 @@ services: VIRTUAL_HOST: uechi.io LETSENCRYPT_HOST: uechi.io volumes: - - "./data:/var/www/html/★/:ro" + - "./data:/var/www/html/_:ro" + labels: + com.centurylinklabs.watchtower.enable: "true" + cron: + image: ghcr.io/uetchy/uechi.io + command: /usr/sbin/crond -d 8 -f + restart: unless-stopped + container_name: uechi.io-cron + volumes: + - "./data:/var/www/html/_" + - "./periodic/daily:/etc/periodic/daily:ro" labels: com.centurylinklabs.watchtower.enable: "true" diff --git a/periodic/daily/280blocker b/periodic/daily/280blocker new file mode 100755 index 0000000..ce50b97 --- /dev/null +++ b/periodic/daily/280blocker @@ -0,0 +1,6 @@ +#!/bin/sh + +echo "Updating 280blocker filter..." + +FILTER_PATH="/var/www/html/_/280blocker.txt" +curl -sL "https://280blocker.net/files/280blocker_adblock_$(date +"%Y%m").txt" -o "$FILTER_PATH"