From a1c365ae0579d6241d91aa34971d4dbbefe2a083 Mon Sep 17 00:00:00 2001 From: Firq Date: Thu, 16 Mar 2023 18:07:28 +0100 Subject: [PATCH] Added caching to images --- .gitlab-ci.yml | 2 +- serve.json | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 serve.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c785f75..3bfac54 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,7 @@ deploy-site: script: - echo "Connecting to proxmox machine" - - ssh $DEPLOY_USER@$DEPLOY_HOST -o StrictHostKeyChecking=no IdentitiesOnly=yes "screen -X -S website-firq-npx kill; rm -r -f public/*; cd build; git reset --hard; git pull; rm -r -f node_modules; npm install; npm run build; cp -R public ~; cd ~; screen -S website-firq-npx -dm npx serve public/ -p 9000" + - ssh $DEPLOY_USER@$DEPLOY_HOST -o StrictHostKeyChecking=no IdentitiesOnly=yes "screen -X -S website-firq-npx kill; rm -r -f public/*; cd build; git reset --hard; git pull; rm -r -f node_modules; npm install; npm run build; cp -R public ~; cp server.json ~; cd ~; screen -S website-firq-npx -dm npx serve public/ -p 9000 -c serve.json" success_notification: stage: notification diff --git a/serve.json b/serve.json new file mode 100644 index 0000000..8a4d530 --- /dev/null +++ b/serve.json @@ -0,0 +1,13 @@ +{ + "headers": [ + { + "source": "**/*.@(jpg|jpeg|gif|png|webp)", + "headers": [ + { + "key": "Cache-Control", + "value": "max-age=7200" + } + ] + } + ] +}