From 35afd9208fc9be90e0331eb0c78a1aa9d146fe0e Mon Sep 17 00:00:00 2001 From: Santhosh Janardhanan Date: Tue, 10 Feb 2026 05:32:05 -0500 Subject: [PATCH] Cron ready refresh script --- docker-compose.yml | 9 +++++++++ scripts/refresh.sh | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2627bbd..352aafd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,9 @@ services: PUBLIC_ENABLE_SW: "true" ports: - "8080:80" + networks: + - fast-website-network + redis: image: redis:7-alpine @@ -20,3 +23,9 @@ services: interval: 5s timeout: 3s retries: 20 + networks: + - fast-website-network + +networks: + fast-website-network: + driver: bridge \ No newline at end of file diff --git a/scripts/refresh.sh b/scripts/refresh.sh index 37db327..989c3a9 100644 --- a/scripts/refresh.sh +++ b/scripts/refresh.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh ## Fetch content, build the image, clear the cache and restart the container -docker run -it -v $(pwd)/site:/usr/src/app -w /usr/src/app node:24-alpine npm run fetch-content +docker run --rm -it --network container:$(docker compose ps -q redis) -v "${PWD}:/usr/src/app" -w /usr/src/app/site -e CACHE_REDIS_URL="redis://127.0.0.1:6379/0" node:24-alpine npm run fetch-content docker build --build-arg PUBLIC_ENABLE_SW=true -t fast-website:local . -docker run -it -v $(pwd)/site:/usr/src/app -w /usr/src/app node:24-alpine npm run cache:clear +docker run --rm -it --network container:$(docker compose ps -q redis) -v "${PWD}:/usr/src/app" -w /usr/src/app/site -e CACHE_REDIS_URL="redis://127.0.0.1:6379/0" node:24-alpine npm run cache:clear docker compose up -d \ No newline at end of file