Compare commits

..

1 Commits

Author SHA1 Message Date
26edf1d4b2 Improve SPA cacheing
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-11-06 18:35:05 +01:00
2 changed files with 50 additions and 99 deletions

View File

@ -4,39 +4,12 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
kind: pipeline kind: pipeline
type: docker type: docker
name: qa name: default
trigger:
event:
- push
- pull_request
branch:
- main
steps: steps:
- name: reuse - name: reuse
image: fsfe/reuse image: fsfe/reuse:latest
- name: lint
image: node:20
commands:
- npm ci
- npm run lint
---
kind: pipeline
type: docker
name: build
trigger:
event:
- push
branch:
- main
depends_on:
- qa
steps:
- name: docker-publish - name: docker-publish
image: plugins/docker image: plugins/docker
settings: settings:
@ -48,59 +21,23 @@ steps:
from_secret: "docker_username" from_secret: "docker_username"
password: password:
from_secret: "docker_password" from_secret: "docker_password"
when:
---
kind: pipeline
type: docker
name: deploy
trigger:
event: event:
- push - push
branch: branch:
- main - main
depends_on: - name: docker-publish-tag
- build image: plugins/docker
steps:
- name: deploy-dev
image: appleboy/drone-ssh
settings: settings:
host: registry: registry.wtf-eg.net
- dev01.wtf-eg.net repo: registry.wtf-eg.net/ki-frontend
username: drone_deployment target: ki-frontend
key: auto_tag: true
from_secret: "dev01_deployment_key" username:
command_timeout: 2m from_secret: "docker_username"
script: password:
- echo "Executing forced command..." from_secret: "docker_password"
when:
---
kind: pipeline
type: docker
name: tag-release
trigger:
event: event:
- tag - tag
steps:
- name: reuse
image: fsfe/reuse
- name: lint
image: node:20
commands:
- npm ci
- npm run lint
- name: docker-publish
image: plugins/docker
settings:
registry: registry.wtf-eg.net
repo: registry.wtf-eg.net/ki-frontend
target: ki-frontend
auto_tag: true
username:
from_secret: "docker_username"
password:
from_secret: "docker_password"

View File

@ -9,10 +9,24 @@ server {
#access_log /var/log/nginx/host.access.log main; #access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html; # routes without dots serve the index.html without caching
location / {
add_header Cache-Control "no-cache";
try_files $uri $uri/index.html /index.html;
}
# static js and css files that get replaced instead of updated
location ~ \.(js|css) {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# cache other static files for 30 days
location ~ \.(?!html) {
add_header Cache-Control "public, max-age=2592000";
try_files $uri =404;
} }
#error_page 404 /404.html; #error_page 404 /404.html;